如何在UINavigationController中获取弹出视图的通知? [英] How to get notified of popped view in UINavigationController?

查看:151
本文介绍了如何在UINavigationController中获取弹出视图的通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们到达某个 UIViewController UINavigationController 后面的按钮时,我想执行一个动作>。

I want to perform a action when the user pressed the back button on my UINavigationController when arrived at a certain UIViewController.

不幸的是,它看起来像 UINavigationControllerDelegate 没有任何方法可以通知视图的弹出。

Unfortunately it looks like UINavigationControllerDelegate doesn't have any methods to get notified of the popping of views.

作为一种解决方法,我现在在 viewDidDisappear 方法中的操作,只有当$ code>动画是 YES 。这是有用的,但这有点丑陋。

As a workaround I now have in the viewDidDisappear method my action, that only gets fired when animated is YES. This works, but it's a bit ugly.

我该怎么做?

推荐答案

当viewWillDisappear或在某些UIViewController的viewWillAppear上设置逻辑时,您可以调用委托方法。

You can either call a delegate method when viewWillDisappear or set logic on viewWillAppear for certain UIViewController.

这篇关于如何在UINavigationController中获取弹出视图的通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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