iOS处理多次push的方法

2016-08-07  本文已影响0人  CaptainJK
class LLBaseNavigationController: UINavigationController,UIGestureRecognizerDelegate {
    
    var _isTrasiting:Bool = false
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func pushViewController(viewController: UIViewController, animated: Bool) {
        if _isTrasiting
        {
            return
        }
        _isTrasiting = true
        super.pushViewController(viewController, animated: animated)
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (Int64)(1 * NSEC_PER_SEC)), dispatch_get_main_queue()) {[weak self]() -> Void in
            
            guard let strongSelf = self else {return}
            strongSelf._isTrasiting = false
            
        }
    }
}
上一篇 下一篇

猜你喜欢

热点阅读