Find out if user pressed the back button in uinavigationcontroller?

后端 未结 7 1628
时光说笑
时光说笑 2020-12-01 03:34

When a view loads, i want to see if it\'s because the user pressed the back button. How can i check this?

相关标签:
7条回答
  • 2020-12-01 04:10

    For the sake of completeness, mix of two most upvoted answers (1, 2) in Swift:

    override func willMoveToParentViewController(parent: UIViewController?) {
        super.willMoveToParentViewController(parent)
        if parent == nil {
            // view controller is popping
        }
    }
    
    0 讨论(0)
提交回复
热议问题