Find out if user pressed the back button in uinavigationcontroller?

后端 未结 7 1633
时光说笑
时光说笑 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:09

    in your viewWillDisappear method check

    - (void)viewWillDisappear:(BOOL)animated {
        [super viewWillDisappear:animated];
    
        if ([self isMovingFromParentViewController]) {
          //specific stuff for being popped off stack
        }
    }
    

    This is only for post iOS 5

提交回复
热议问题