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;

 

posted @ 2016-01-12 11:08  webglcn  阅读(131)  评论(0)    收藏  举报