Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我无法使用导航控制器控制视图控制器上的某些变量。因此,当我按下后退按钮时,我想在该视图控制器上运行一个方法(函数),然后再转到前一个视图控制器。
You can either define a custom action for the back button, run your code, and then call [UINavigationController popViewController:animated:], or you can set your code in -viewWillDisappear: if that's appropriate for what you're doing.
[UINavigationController popViewController:animated:]
-viewWillDisappear: