iphone - 在presentModalViewController之后使用pushViewController

标签 iphone cocoa-touch

在我的应用程序中,我将 BaseViewController (NavigationController) 作为根 Controller 。我通常使用以下代码进行导航:

[self.navigationController pushViewController:childController animated:YES];

但是在其中一个操作中,我希望下一个 View 将按钮动画到顶部,所以我使用:

[self presentModalViewController:childController animated:YES];

到目前为止一切正常。在模态视图中,我想推送另一个 Controller ,但这似乎不起作用。我尝试过以下方法:

// self.navigationController is null, so this doesn't work
[self.navigationController pushViewController:childController animated:YES];

// self.parentViewController is the BaseViewController and not null, but this 
// won't work either. This also generates a warning "UIViewController' may not 
// respond to '-pushViewController:animated:"
[self.parentViewController pushViewController:childController animated:YES];

这两种情况都没有发生。当模态视图仍然显示时,pushViewController 是否被禁用?如果是这样,还有其他方法吗:

  1. 从下到上为下一个 Controller 设置动画
  2. 像往常一样使用后退按钮从左到右设置下一个 Controller 的动画。后退按钮应带您返回到上一个(模式) View 。

最佳答案

如果您呈现ModelViewController,那么您需要先关闭它,然后才能调用导航 Controller 的方法,否则您必须将此 View Controller 放入导航堆栈中,以便将另一个 View Controller 放在其顶部。

关于iphone - 在presentModalViewController之后使用pushViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2418772/

相关文章:

iphone - RowAnimation 对于不同高度的单元格看起来很奇怪

iphone - UIButton 的图像与背景图像

ios - 如何更改 iOS TableView 索引颜色?

swift - 如何知道对象内部的异步函数何时完成?

iphone - iTunes 专辑插图尚未准备好用于视网膜显示!如何解决?

iphone - 如何圆化 UIImage 的边缘?

ios - 隐藏导航 Controller 的 rightBarButtonItem

iphone - MPMediaItemArtwork 返回错误大小的图稿

objective-c - NSDateformatter 返回零?

iphone - 适用于 ios 的 360° 全景库