UI基础 - UITabBarController
self.window = [[UIWindow alloc] init]; self.window.frame = [UIScreen mainScreen].bounds; oneViewController *oneview = [[oneViewController alloc] init]; //设置tabbarItem的图片并且设置渲染模式为UIImageRenderingModeAlwaysOriginal(不渲染,使用原始图片) 默认渲染 oneview.tabBarItem.image = [[UIImage imageNamed:@"tabbar_discover_selected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; //设置选中控制器的tabbarItem的图片并且设置渲染模式为UIImageRenderingModeAlwaysOriginal(不渲染,使用原始图片) 默认渲染 oneview.tabBarItem.selectedImage = [[UIImage imageNamed:@"tabbar_discover_os7"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; twoViewController *twoview = [[twoViewController alloc] init]; twoview.tabBarItem.image = [[UIImage imageNamed:@"tabbar_home"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; twoview.tabBarItem.selectedImage = [[UIImage imageNamed:@"tabbar_home_selected_os7"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; XJTabBarController *tabC = [[XJTabBarController alloc] init]; //添加子控制器方式一 // [tabC addChildViewController:oneview]; //添加子控制器方式二 tabC.viewControllers = @[oneview,twoview]; self.window.rootViewController = tabC;