使用系统UITabbarItem自定义图片显示原本颜色和自定义文字颜色
2015-04-12 20:33
477 查看
。。。。。。
ThirdViewController *thirdVC = [[ThirdViewControlleralloc]initWithTitle:@"搜索信息"];
//设置tabbarItem 的图片显示原图颜色;
thirdVC.tabBarItem = [[UITabBarItemalloc]initWithTitle:@"搜索"image:[[UIImageimageNamed:@"login_usernick"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImageimageNamed:@"login_usernick_highlighted"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
//一句话改变图片和文字的颜色均为红色选中时候
// [[UITabBar appearance]setTintColor:[UIColor redColor]];
//只是设置TabBarItem的字体颜色
[[UITabBarItemappearance] setTitleTextAttributes:[NSDictionarydictionaryWithObject:[UIColorblackColor] forKey:NSForegroundColorAttributeName] forState:UIControlStateNormal];
[[UITabBarItemappearance] setTitleTextAttributes:[NSDictionarydictionaryWithObject:[UIColorredColor] forKey:NSForegroundColorAttributeName] forState:UIControlStateSelected];
RootNavgationController*nav3 = [[RootNavgationControlleralloc]initWithRootViewController:thirdVC];
NSArray *VCs= [NSArray arrayWithObjects:nav1,nav2,nav3, nil];
tabControl.viewControllers = VCs;
self.window.rootViewController = tabControl;
ThirdViewController *thirdVC = [[ThirdViewControlleralloc]initWithTitle:@"搜索信息"];
//设置tabbarItem 的图片显示原图颜色;
thirdVC.tabBarItem = [[UITabBarItemalloc]initWithTitle:@"搜索"image:[[UIImageimageNamed:@"login_usernick"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImageimageNamed:@"login_usernick_highlighted"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
//一句话改变图片和文字的颜色均为红色选中时候
// [[UITabBar appearance]setTintColor:[UIColor redColor]];
//只是设置TabBarItem的字体颜色
[[UITabBarItemappearance] setTitleTextAttributes:[NSDictionarydictionaryWithObject:[UIColorblackColor] forKey:NSForegroundColorAttributeName] forState:UIControlStateNormal];
[[UITabBarItemappearance] setTitleTextAttributes:[NSDictionarydictionaryWithObject:[UIColorredColor] forKey:NSForegroundColorAttributeName] forState:UIControlStateSelected];
RootNavgationController*nav3 = [[RootNavgationControlleralloc]initWithRootViewController:thirdVC];
NSArray *VCs= [NSArray arrayWithObjects:nav1,nav2,nav3, nil];
tabControl.viewControllers = VCs;
self.window.rootViewController = tabControl;
相关文章推荐
- 解决iOS8以上系统下app底部UITabBarItem上自定义的背景色和图片,在首次启动或push之后再pop回去会变成系统默认颜色-蓝色问题
- ios之UITabBarItem显示真实自定义的图片而非颜色填充
- ios之UITabBarItem显示真实自定义的图片而非颜色填充
- 【UI-基础】改变UITabBarItem图片的颜色及文字
- 使用自定义的item、Adapter和AsyncTask、第三方开源框架PullToRefresh联合使用实现自定义的下拉列表(从网络加载图片显示在item中的ImageView)
- ios 开发中,如何设置 uitabbar 里面 tabbaritem 不显示文字,只显示图片,图片垂直居中?
- xcode6.1 自定义tabbar与poptoview产生重叠问题以及ios8上自定义tabbar图片显示颜色是系统颜色问题
- 在iOS8系统下,UITabbar上的item自定义背景色和图片问题
- 在iOS8系统下,UITabbar上的item自定义背景色和图片问题 (
- Android SeekBar自定义使用图片和颜色显示
- 关于标签栏(UITabBarItem)的系统颜色和图片以及标题颜色的问题
- iOS7修改UITabBar文本颜色以及解决自定义选中图片显示为默认蓝色的问题
- 在iOS8系统下,UITabbar上的item自定义背景色和图片问题
- IOS 7修改UITabbar背景图片、UITabBarItem图片以及UITabBarItem的文字颜色.
- 使用自定义的item、Adapter和AsyncTask、第三方开源框架PullToRefresh联合使用实现自定义的下拉列表(从网络加载图片显示在item中的ImageView)
- 在iOS8系统下,UITabbar上的item自定义背景色和图片问题
- swift-UITabBarController 设置选中和未选中状态文字图片颜色或使用原图
- 在iOS8系统下,UITabbar上的item自定义背景色和图片问题
- Android Toolbar使用系统原生返回键,并改变其颜色,自定义图片替换系统原生返回键
- Android SeekBar自定义使用图片和颜色显示