Skip to content →

Month: September 2014

How to get the main storyboard

Here’s how to get at the main storyboard from inside your view controller.

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:
[[NSBundle mainBundle].infoDictionary objectForKey:@"UIMainStoryboardFile"]
bundle:[NSBundle mainBundle]];

Most of the time you can just use self.storyboard. But if you are in a view controller that was not created by a storyboard, then self.storyboard will be nil.

Comments closed