Adding a navigation controller in Tab bar controller

[sourcecode language=”objc”]
– (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *viewController1 = [[TPFirstViewController alloc] init];
UIViewController *viewController2 = [[TPSecondViewController alloc] init];
self.tabBarController = [[UITabBarController alloc] init];
UINavigationController *controller1 = [[UINavigationController alloc] initWithRootViewController:viewController1];
self.tabBarController.viewControllers = @[controller1, viewController2];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
[/sourcecode]

Leave a Reply

Your email address will not be published. Required fields are marked *