开发者

Controlling changes in the navigation stack

开发者 https://www.devze.com 2023-01-26 14:53 出处:网络
I want to be able to check for specific conditions when a user selects the \"back\" button from a naviga开发者_Python百科tion controller - then display an alert and stop the pop up the navigation stac

I want to be able to check for specific conditions when a user selects the "back" button from a naviga开发者_Python百科tion controller - then display an alert and stop the pop up the navigation stack from occurring.

I can get notified in the viewWillDissappear method that the pop is about to occur - but is there a mechanism to stop the pop from happening?


You can try subclassing UINavigationController and then override the popViewController method to include your logic.

- (UIViewController *)popViewControllerAnimated:(BOOL)animated

[edit to include an example] http://www.hanspinckaers.com/custom-action-on-back-button-uinavigationcontroller

Cheers, Rog

0

精彩评论

暂无评论...
验证码 换一张
取 消