不支持推送导航控制器 [英] Pushing a navigation controller is not supported

查看:103
本文介绍了不支持推送导航控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的MainStoryBoard中我想将viewController推送到detailView但是我收到此错误:

In my MainStoryBoard I want to push a viewController to the detailView but I get this error:


NSInvalidArgumentException',原因:'推送不支持导航控制器'

NSInvalidArgumentException', reason: 'Pushing a navigation controller is not supported'

我在故事板上为viewController设置标识符'JSA'ID。

I set the identifier 'JSA' ID for the viewController on the storyboard.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        SWSJSAViewController *viewController = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"JSA"];
        [self.navigationController pushViewController:viewController animated:YES];
    }
}


推荐答案

rmaddy 在评论中说你正试图推动导航控制器。

Like rmaddy said in the comments you are trying to push a navigation controller.

应该呈现导航控制器(通过presentViewController或者它们可以作为childViewController添加),并且应该推送ViewControllers。

Navigation controllers should be presented (via presentViewController or they can be added as a childViewController) and ViewControllers should be pushed.

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

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