ios:在模型视图上推送另一个ViewController [英] ios: Pushing another ViewController on a model view

查看:83
本文介绍了ios:在模型视图上推送另一个ViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个以模态形式呈现的viewcontroller.

I have a viewcontroller that is presented modally.

[self presentModalViewController:ViewControllerA animated:YES];

在此ViewControllerA中,我有一个表格视图,当用户单击某个单元格时,应将另一个ViewControllerB推到当前视图的顶部.

Within this ViewControllerA I've got a table view and when the user clicks on a cell another ViewControllerB should be pushed on top of the current one.

- (void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [self.navigationController pushViewController:ViewControllerB animated:YES];

问题:我无法推​​送任何内容,因为它是从以模态显示的viewconrtroller推送的.有什么办法可以解决我的问题?

The problem: I cannot push anything because it is push from a modally presented viewconrtroller. Is there some way to solve my problem?

推荐答案

您可以将ViewControllerB推入另一个模式视图.

You can push ViewControllerB as another modal view.

但是,如果您想使用导航控制器,请参阅Apple文档的以下部分:

But if you want to use the navigational controller, here is a section from Apple's doc:

您可以以模态方式呈现UINavigationController对象,方式与呈现自定义视图控制器相同. (在极少数情况下,您甚至可以显示一个标签栏控制器.)

You can present UINavigationController objects modally in the same way that you would present a custom view controller. (In rare cases, you could even present a tab bar controller.)

以模态方式显示导航控制器时,始终会呈现UINavigationController对象本身,而不是在其导航堆栈上呈现任何视图控制器.但是,导航堆栈上的各个视图控制器本身可能会模态地呈现其他视图控制器,包括其他导航控制器.

When presenting a navigation controller modally, you always present the UINavigationController object itself, rather than presenting any of the view controllers on its navigation stack. However, individual view controllers on the navigation stack may themselves present other view controllers modally, including other navigation controllers.

这篇关于ios:在模型视图上推送另一个ViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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