Question

I try many sings from this site but not get result. Now I open new View like this:

//(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];

all working good, but I want previous View be in the same state when I return to him. People say use NavigationController and push to him but this is a problem. I add NavigationController to storyboard (to MainReportView) and try change code to:

 [self pushViewController:info animated:YES completion:nil];

but nothing happens, view not open, please help how I can programatically in this code add NavigationController and open my InfoController with push ? Thanks ! (I use Xcode 5 and iOS 7 + Storyboard)

Solution - for iOS7 use prepareForSegue, and this tutorial

Was it helpful?

Solution

enter image description here

UIStoryboard *MainStoryboard = [UIStoryboard storyboardWithName:@"Main"
                                                         bundle: nil];
InfoController *info=[MainStoryboard instantiateViewControllerWithIdentifier:@"InfoController"];
[self.navigationController pushViewController:info animated:YES completion:nil]; 

full step by step guide

OTHER TIPS

Push the new view controller in the navigation controller like this:

InfoController *info = (InfoController *)[self.storyboard instantiateViewControllerWithIdentifier:@"InfoController"];
[self.navigationController pushViewController:info animated:YES completion:nil]; 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top