UINavigationController 与 UITabBarController

http://www.cnblogs.com/YouXianMing/p/3756904.html

// index start from 1.
UITabBarItem *newsItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFavorites tag:1];
//UITabBarItem *homeItem = [[UITabBarItem alloc] initWithTitle:@"首页" image:[UIImage imageNamed: @""] tag:1];
NewsViewController *newsController = [[NewsViewController alloc] init];
newsController.tabBarItem = newsItem;
[newsItem release];

UINavigationController *newsNav = [[UINavigationController alloc] initWithRootViewController:newsController];
[newsController release];

// repeat other here NSArray
*viewControllers = @[newsNav]; [newsNav release]; UITabBarController *tabController = [[UITabBarController alloc]init]; // tabController.viewControllers = @[newsNav]; [tabController setViewControllers:viewControllers animated:YES]; self.window.rootViewController = tabController;
原文地址:https://www.cnblogs.com/webglcn/p/5123698.html