IOS tableBar设置方法

RedViewController*redVC = [[RedViewControlleralloc]initWithNibName:@"RedViewController"bundle:nil];

GreenViewController*greenVC = [[GreenViewControlleralloc]init];

BlueTableViewController*blueTVC = [[BlueTableViewControlleralloc]init];

UITabBarController*tabBarController = [[UITabBarControlleralloc]init];

UINavigationController*navi = [[UINavigationControlleralloc]initWithRootViewController:redVC];

//navi.tabBarItem.title = @"红色";

[tabBarControlleraddChildViewController:navi];

[tabBarControlleraddChildViewController:greenVC];

[tabBarControlleraddChildViewController:blueTVC];

//设置开始显示是1位置的子控制器

tabBarController.selectedIndex=1;

self.window= [[UIWindowalloc]initWithFrame:[UIScreenmainScreen].bounds];

self.window.rootViewController= tabBarController;

[self.windowmakeKeyAndVisible];

你可能感兴趣的:(IOS tableBar设置方法)