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]
|
||||
if item == sidebar.selectedItem {
|
||||
itemNavStack = secondaryNavController.viewControllers
|
||||
secondaryNavController.viewControllers = []
|
||||
} else {
|
||||
itemNavStack = navigationStacks[item] ?? []
|
||||
navigationStacks.removeValue(forKey: item)
|
||||
|
|
|
@ -121,7 +121,11 @@ class MultiColumnNavigationController: UIViewController {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
@ -233,7 +237,7 @@ private class ColumnView: UIView {
|
|||
}
|
||||
|
||||
func setContent(_ viewController: UIViewController, needsCloseButton: Bool) {
|
||||
guard viewController !== contentViewController else {
|
||||
guard viewController !== contentViewController || viewController.parent !== navigationController else {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue