load view form StoryBoard that does not have a Segue
ios5, ipad, uistoryboard
Solution
I do this in my projects:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *myController = [storyboard instantiateViewControllerWithIdentifier:@"MyViewController"];
[self.navigationController pushViewController: myController animated:YES];
Just make sure you have set your controller's identifier correctly. You can do this by:
- selecting the controller in Storyboard
- in the Utilities panel, click the Attributes inspector. Whatever you decide to put in the Identifier field is what goes in the 'instantiateViewControllerWithIdentifier' statement.
I hope this helps.
Problem
I am really liking having all of my view's laid out in the Storyboard but there are times when I will have a view that is shown based on a button that is generated by code so there will be no Segue reference - it will be totally disconnected in the Storyboard. I would still like to design it in the storyboard though so I can have a nice overview of all my screens. Is it possible for me to load the XIB (or whatever it is in a storyboard) designed in the storyboard when a UIViewControler is loaded?