|
@@ -311,24 +311,24 @@ extension UINavigationController: WRFatherAwakeProtocol
|
|
|
}
|
|
|
|
|
|
|
|
|
- @objc func wr_popToViewController(_ viewController: UIViewController, animated: Bool) -> [UIViewController]?
|
|
|
- {
|
|
|
- setNeedsNavigationBarUpdate(titleColor: viewController.navBarTitleColor)
|
|
|
- var displayLink:CADisplayLink? = CADisplayLink(target: self, selector: #selector(popNeedDisplay))
|
|
|
-
|
|
|
-
|
|
|
- displayLink?.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
|
|
|
- CATransaction.setCompletionBlock {
|
|
|
- displayLink?.invalidate()
|
|
|
- displayLink = nil
|
|
|
- popProperties.displayCount = 0
|
|
|
- }
|
|
|
- CATransaction.setAnimationDuration(popProperties.popDuration)
|
|
|
- CATransaction.begin()
|
|
|
- let vcs = wr_popToViewController(viewController, animated: animated)
|
|
|
- CATransaction.commit()
|
|
|
- return vcs
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
@objc func wr_popToRootViewControllerAnimated(_ animated: Bool) -> [UIViewController]?
|
|
@@ -416,29 +416,29 @@ extension UINavigationController: WRFatherAwakeProtocol
|
|
|
|
|
|
extension UINavigationController: UINavigationBarDelegate
|
|
|
{
|
|
|
- public func navigationBar(_ navigationBar: UINavigationBar, shouldPop item: UINavigationItem) -> Bool
|
|
|
- {
|
|
|
- if let topVC = topViewController,
|
|
|
- let coor = topVC.transitionCoordinator, coor.initiallyInteractive {
|
|
|
- if #available(iOS 10.0, *) {
|
|
|
- coor.notifyWhenInteractionChanges({ (context) in
|
|
|
- self.dealInteractionChanges(context)
|
|
|
- })
|
|
|
- } else {
|
|
|
- coor.notifyWhenInteractionEnds({ (context) in
|
|
|
- self.dealInteractionChanges(context)
|
|
|
- })
|
|
|
- }
|
|
|
- return true
|
|
|
- }
|
|
|
-
|
|
|
- let itemCount = navigationBar.items?.count ?? 0
|
|
|
- let n = viewControllers.count >= itemCount ? 2 : 1
|
|
|
- let popToVC = viewControllers[viewControllers.count - n]
|
|
|
-
|
|
|
- popToViewController(popToVC, animated: true)
|
|
|
- return true
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
private func dealInteractionChanges(_ context: UIViewControllerTransitionCoordinatorContext)
|