ios swift 判断uiviewcontroller时push present 进来的 还是pop进来的

override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        //显示navbar
        self.navigationController?.setNavigationBarHidden(false, animated: true)
        
        if(isBeingPresented || isMovingToParent){
            print("======push")
        }else{
            print("======pop")
        }
    }

  

原文地址:https://www.cnblogs.com/rchao/p/12092785.html