iOS UITabBarController使用

```
UIViewController *firstViewController = [[ShowListVC alloc] init];
UIViewController *firstNavigationController = [[UINavigationController alloc]
                                               initWithRootViewController:firstViewController];
firstNavigationController.tabBarItem.title=@"真題";
firstNavigationController.tabBarItem.image=[UIImage imageNamed:@"book.png"];

UIViewController *secondViewController = [[UITableViewController alloc] init];
UIViewController *secondNavigationController = [[UINavigationController alloc]
                                                initWithRootViewController:secondViewController];
secondViewController.tabBarItem.title=@"推薦";
secondViewController.tabBarItem.image=[UIImage imageNamed:@"attach.png"];

UIViewController *thirdViewController = [[UIViewController alloc] init];
UIViewController *thirdNavigationController = [[UINavigationController alloc]
                                               initWithRootViewController:thirdViewController];
thirdNavigationController.tabBarItem.title=@"我";
thirdNavigationController.tabBarItem.image=[UIImage imageNamed:@"calendar.png"];


UITabBarController *tabBarController = [[UITabBarController alloc] init];
[tabBarController setViewControllers:@[firstNavigationController, secondNavigationController,
                                       thirdNavigationController]];
//self.viewController = tabBarController;
[self.window setRootViewController:tabBarController];

```
相關文章
相關標籤/搜索