forked from shadowfacts/Tusker
Fix incorrect split nav layout when closing split with new sidebar
This commit is contained in:
parent
9b2e6140a3
commit
9547bd2913
|
@ -241,13 +241,19 @@ class SplitNavigationController: UIViewController {
|
||||||
// otherwise the secondary nav's contents disappear immediately, rather than sliding off-screen
|
// otherwise the secondary nav's contents disappear immediately, rather than sliding off-screen
|
||||||
let animator = UIViewPropertyAnimator(duration: 0.35, curve: .easeInOut) {
|
let animator = UIViewPropertyAnimator(duration: 0.35, curve: .easeInOut) {
|
||||||
self.isLayingOutForAnimation = true
|
self.isLayingOutForAnimation = true
|
||||||
self.setSecondaryVisible(false)
|
NSLayoutConstraint.deactivate(self.constraints)
|
||||||
|
self.constraints = [
|
||||||
|
self.rootNav.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor, constant: self.rootNav.view.bounds.minX),
|
||||||
|
self.rootNav.view.trailingAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.trailingAnchor),
|
||||||
|
self.secondaryNav.view.widthAnchor.constraint(equalToConstant: self.secondaryNav.view.bounds.width),
|
||||||
|
]
|
||||||
|
NSLayoutConstraint.activate(self.constraints)
|
||||||
self.view.layoutIfNeeded()
|
self.view.layoutIfNeeded()
|
||||||
}
|
}
|
||||||
animator.addCompletion { _ in
|
animator.addCompletion { _ in
|
||||||
self.secondaryNav.viewControllers = []
|
|
||||||
self.isLayingOutForAnimation = false
|
self.isLayingOutForAnimation = false
|
||||||
// self.updateSecondaryNavVisibility()
|
self.secondaryNav.viewControllers = []
|
||||||
|
self.updateSecondaryNavVisibility()
|
||||||
}
|
}
|
||||||
animator.startAnimation()
|
animator.startAnimation()
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue