How to add UINavigationController to UITabbarController Programatically?


Hi,

Today I am going to Explain you How to Add UINavigation Controller to UITabbarController.

  • When you add UIViewController to UIWindow Your Application become ViewControllerBase(SingleView) Application.
  • When you add UIViewController to UINavigationController your application become NavigationBased(Master-Detail) Application.
  • When you add UIViewController/UINavigationController to your UITabbarController Your application become Tabbased Application.

so here we are using the same concept that add your Navigation Controller to UITabbarController so you will get Push/Pop effect in UITabbar Controller.

//Initialize tabbar Controller and All Navigation Controllers are added into Tabbar Controller
self.tabbar = [[UITabBarController alloc] init];
NSArray *arrNVControllers = [NSArray arrayWithObjects:nav1,nav2,nav3,nav4, nil];

self.tabbar.viewControllers = arrNVControllers;

Download the sample code from Here

Leave a comment