Reputation: 849
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
Upvotes: 1
Views: 1159
Reputation: 5754
UIStoryboard *MainStoryboard = [UIStoryboard storyboardWithName:@"Main"
bundle: nil];
InfoController *info=[MainStoryboard instantiateViewControllerWithIdentifier:@"InfoController"];
[self.navigationController pushViewController:info animated:YES completion:nil];
Upvotes: 5
Reputation: 3506
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];
Upvotes: 1