I have a tab bar that is created programmatically and I’m having difficulties initializing a storyboard associated with a view.
I’m able to load the view successfully in the tab bar without the storyboard (see code below) but the view is only partially showing because some of the UI components are in the storyboard.
The name of my storyboard is MainStoryboard and I set the storyboard view identifier to SettingsViewController.
How can I initialize my storyboard for SettingsViewController in the code below?
- (void)createTabBarItems {
tabBarController = [[UITabBarController alloc] init];
settingsViewController = [[SettingsViewController alloc] init];
UINavigationController *sett = [[[UINavigationController alloc]
initWithRootViewController: settingsViewController] autorelease];
[sett.tabBarItem setTitle:@"Settings"];
[sett.tabBarItem setImage:[UIImage imageNamed:@"settings.png"]];
[tabBarController setViewControllers:
[NSArray arrayWithObjects:sett, sett, sett, sett, nil]];
}
If you want to initialize the view controller as in the storyboard you have to use the storyboard methods instead of allocating the view controller directly: