forked from shadowfacts/Tusker
Fix crash when split VC collapses with multi-column nav controller
This commit is contained in:
parent
88105f22a0
commit
f1a6a405c2
|
@ -169,6 +169,7 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
|
||||||
var itemNavStack: [UIViewController]
|
var itemNavStack: [UIViewController]
|
||||||
if item == sidebar.selectedItem {
|
if item == sidebar.selectedItem {
|
||||||
itemNavStack = secondaryNavController.viewControllers
|
itemNavStack = secondaryNavController.viewControllers
|
||||||
|
secondaryNavController.viewControllers = []
|
||||||
} else {
|
} else {
|
||||||
itemNavStack = navigationStacks[item] ?? []
|
itemNavStack = navigationStacks[item] ?? []
|
||||||
navigationStacks.removeValue(forKey: item)
|
navigationStacks.removeValue(forKey: item)
|
||||||
|
|
|
@ -121,7 +121,11 @@ class MultiColumnNavigationController: UIViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func scrollToEnd(animated: Bool) {
|
private func scrollToEnd(animated: Bool) {
|
||||||
scrollColumnToEnd(columnIndex: viewControllers.count - 1, animated: animated)
|
if viewControllers.isEmpty {
|
||||||
|
scrollView.setContentOffset(.init(x: -scrollView.adjustedLeadingContentInset, y: -scrollView.adjustedContentInset.top), animated: false)
|
||||||
|
} else {
|
||||||
|
scrollColumnToEnd(columnIndex: viewControllers.count - 1, animated: animated)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func scrollColumnToEnd(columnIndex: Int, animated: Bool) {
|
private func scrollColumnToEnd(columnIndex: Int, animated: Bool) {
|
||||||
|
@ -233,7 +237,7 @@ private class ColumnView: UIView {
|
||||||
}
|
}
|
||||||
|
|
||||||
func setContent(_ viewController: UIViewController, needsCloseButton: Bool) {
|
func setContent(_ viewController: UIViewController, needsCloseButton: Bool) {
|
||||||
guard viewController !== contentViewController else {
|
guard viewController !== contentViewController || viewController.parent !== navigationController else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue