如何推到新的视图以编程方式创建的UINavigationController?

Nev*_*_be 1 xcode uinavigationcontroller navigationcontroller ios

我尝试了很多从这个网站唱,但没有得到结果.现在我打开这样的新视图:

//(I call this code from View called MainReportView)
InfoController *info = (InfoController *)[self.storyboard instantiateViewControllerWithIdentifier:@"InfoController"];

info.login = login;
info.password = password;

[self presentViewController:info animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

所有工作不错,但我想以前的视图中处于相同的状态,当我回到他身边.人们说使用NavigationController推到他,但是这是一个问题.我想补充NavigationController到故事板(以MainReportView),并尝试改变代码:

 [self pushViewController:info animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

但没有任何反应,视图未打开,请帮助我如何以编程方式在此代码中添加NavigationController并使用push打开我的InfoController?谢谢 !(I使用的Xcode 5和iOS 7 +故事板)

解决方案-为iOS7使用prepareForSegue,这个教程

May*_*ain 5

在此输入图像描述

UIStoryboard *MainStoryboard = [UIStoryboard storyboardWithName:@"Main"
                                                         bundle: nil];
InfoController *info=[MainStoryboard instantiateViewControllerWithIdentifier:@"InfoController"];
[self.navigationController pushViewController:info animated:YES completion:nil]; 
Run Code Online (Sandbox Code Playgroud)

全逐步指南