控制导航堆栈中的更改 [英] Controlling changes in the navigation stack

查看:58
本文介绍了控制导航堆栈中的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户从导航控制器中选择后退按钮时,我希望能够检查特定条件-然后显示警报并阻止弹出导航堆栈。

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

我可以在viewWillDissappear方法中得到通知,即将发生流行音乐-但是是否有一种机制可以阻止流行音乐的发生?

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?

推荐答案

您可以尝试对UINavigationController进行子类化,然后重写popViewController方法以包含您的逻辑。

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

- (UIViewController *)popViewControllerAnimated:(BOOL)animated


http ://www.hanspinckaers.com/custom-action-on-back-button-uinavigationcontroller

干杯,
Rog

Cheers, Rog

这篇关于控制导航堆栈中的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆