[英]iOS - navigation controller from storyboard
I have embedded my view controller in a navigation controller on my storyboard, then added a table view which I configured from code. 我将视图控制器嵌入情节提要中的导航控制器中,然后添加了一个从代码配置的表格视图。 I'm trying to make it, when I click a row in the table, it should change the view and putting the subview into the stack, however I can't access the navigation controller.
我试图做到这一点,当我单击表中的一行时,它应该更改视图并将子视图放入堆栈中,但是我无法访问导航控制器。
[self.navigationController pushViewController:disclosureView animated:YES];
When this code launches, it gives the error: " NavController[990:c07] Application tried to push a nil view controller on target . " 启动此代码时,它将显示错误:“ NavController [990:c07]应用程序试图将nil视图控制器推入目标。”
I hope that you didn't get call the ViewController properly : 我希望您没有正确调用ViewController:
if(indexPath.row == 0)
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *disclosureView = [storyboard instantiateViewControllerWithIdentifier:@"disclosureView" ];
[self.navigationController pushViewController:disclosureView animated:YES];
Here is the screenShot for getting the UIViewController identifier: 这是获取UIViewController标识符的screenShot:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.