UI基础 - UITabBarController
Posted 偏执Code
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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;
以上是关于UI基础 - UITabBarController的主要内容,如果未能解决你的问题,请参考以下文章
iOS开发UI篇—UITabBarController简单介绍
iOS开发UI篇—UITabBarController生命周期(使用storyoard搭建)