iphone - 一个额外的 popViewController 动画 : when the user presses the Back button?

标签 iphone ios xcode ipad uinavigationcontroller

当用户按下后退按钮从事件的 UINavigationController 中弹出当前的 UIViewController 时,我需要 - 在某种特殊情况下 - 以编程方式从同一个导航 Controller 中弹出另一个 UIViewController(新的顶部)。

(不多说了,请相信我,这并不违反苹果的人机界面准则。相反,如果我不弹出额外的 VC,则可能违反准则)。

我能想到的唯一方法是在 viewWillDisappear: 中放置一个 popViewControllerAnimated:,但不幸的是这不起作用(即使我想要的 VC pop 仍然显示为 self.navigationController.viewControllers 中的最后一个对象)。我在通话中尝试了 YES 和 NO。

viewWillDisappear: 之前,我找不到检测 VC 何时弹出的方法,因为 UINavigationControllerDelegate 没有检测 VC 何时弹出的行为即将被弹出,只有在即将被压入的时候。

有没有办法做到这一点?

最佳答案

在 iOS5 中有一些不错的新方法可以用来检测你是否即将被弹出。

请参阅 UIViewController 包含部分。

- (BOOL)isBeingPresented __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);
- (BOOL)isBeingDismissed __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);
- (BOOL)isMovingToParentViewController __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);
- (BOOL)isMovingFromParentViewController __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);

关于iphone - 一个额外的 popViewController 动画 : when the user presses the Back button?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11506539/

相关文章:

ios - xcode 5中的instanceViewControllerWithIdentifier

iphone - 如何替换 UITableViewCell 中的 imageView?

iphone - XCode错误 "invalid operands to binary expression"

ios - 在 Storyboard 中显示 'Prototype Cells' 的标签在模拟器中显示

ios - 核心数据 swift : Fatal error: unexpectedly found nil while unwrapping an Optional value

ios - 更新扩展委托(delegate)中的数组

swift - 滚动时使用新加载的内容更新 UITableview 单元格

iphone - 谁能给我解释一下 iPhone 中字典的实际结构?

不允许 iOS mkfifo() 操作

ios - NSStream关闭和打开报错