oc中navigationController为nil

iOS 码拜 8年前 (2016-03-25) 1460次浏览
如题,本人想用navigationController跳转页面

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

打印发现添加的viewcontroller有值,但是self.navigationController为nil
本人的界面用storyboard写的,不知道有什么影响。
新手不太懂,麻烦各位了oc中navigationController为nil

解决方案

40

你的self必须是UIViewController的子类,并且已经处于navigationController的堆栈中,假如要做为navigationController的第一个viewcontroller,你可以设置为navigationController的rootViewcontroller

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明oc中navigationController为nil
喜欢 (0)
[1034331897@qq.com]
分享 (0)