This was pretty easy in Xcode 3. But I’m totally lost in Xcode 4.* It looks like IB is not used at all. And all the TabBarController code is in code.
Question: How do I add a NavigationBarController to the default code that Xcode generates when using a TabBarController template?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
As someone has mention you can add a
xibfile an configure the app to use it. Here is the code version in case you decide to go this route it’s always best to know either wayThis is written in the browser but it should work.