         }
         set {
             objc_setAssociatedObject(self, &AssociatedKeys.navBarBgColor, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
-            navigationController?.setNeedsNavigationBackground(color: newValue)
+//            navigationController?.setNeedsNavigationBackground(color: navBarBgColor)
         }
     }
     

        return UIColor(red: nowRed, green: nowGreen, blue: nowBlue, alpha: nowAlpha)
    }
    
    func wr_popToViewController(_ viewController: UIViewController, animated: Bool) -> [UIViewController]? {
        setNeedsNavigationBackground(color: viewController.navBarBgColor)
        navigationBar.tintColor = viewController.navBarTintColor
        return wr_popToViewController(viewController, animated: animated)
    }
    
    func wr_popToRootViewControllerAnimated(_ animated: Bool) -> [UIViewController]? {
        setNeedsNavigationBackground(color: viewControllers.first?.navBarBgColor ?? .defaultNavBarBgColor)
        navigationBar.tintColor = viewControllers.first?.navBarTintColor
        return wr_popToRootViewControllerAnimated(animated)
    }
    
    fileprivate func setNeedsNavigationBackground(color: UIColor) {
        navigationBar.wr_setBackgroundColor(color: color)
    }
}


extension UINavigationController: UINavigationBarDelegate {
    
    public func navigationBar(_ navigationBar: UINavigationBar, shouldPop item: UINavigationItem) -> Bool {
        if let topVC = topViewController,
           let coor = topVC.transitionCoordinator, coor.initiallyInteractive {
            //添加对返回交互的监控

        return true
    }
    
    //处理返回手势中断的情况
    private func dealInteractionChanges(_ context: UIViewControllerTransitionCoordinatorContext)
    {
        let animations: (UITransitionContextViewControllerKey) -> () = {
            let curColor = context.viewController(forKey: $0)?.navBarBgColor ?? UIColor.defaultNavBarBgColor
            self.setNeedsNavigationBackground(color: curColor)
        }
        
        //自动取消了返回手势
        if context.isCancelled
        {
            let cancelDuration: TimeInterval = context.transitionDuration * Double(context.percentComplete)
            UIView.animate(withDuration: cancelDuration) {
                animations(.from)
            }
        }
        else
        {
            //自动完成了返回手势
            let finishDuration: TimeInterval = context.transitionDuration * Double(1 - context.percentComplete)
            UIView.animate(withDuration: finishDuration) {
