TabBar控制器选择颜色

时间:2010-02-24 09:21:18

标签: indexing tabs tabbar selected

是否有人为TabBar控制器应用程序实现了哪个选项卡项目显示除灰色和蓝色以外的其他颜色?

由于

3 个答案:

答案 0 :(得分:1)

您可以使用以下选项更改所选按钮颜色:

self.tabBar.selectedImageTintColor = [UIColor blackColor];

和tabbar背景颜色:

self.tabBar.tintColor = [UIColor whiteColor];

但仅限iOS 5.0

答案 1 :(得分:1)

正如我在此处发布的那样:Change tab bar tint color on iOS 7

有一种更简单的方法可以做到这一点。

只需打开文件检查器并选择“全局色调”。

您还可以在Interface Builder中设置应用的色调颜色。 “文件”检查器的“界面生成器文档”部分中的“全局色调”菜单允许您打开“颜色”窗口或选择特定颜色。

另见:

https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/AppearanceCustomization.html

答案 2 :(得分:0)

试试这个:

UITabBarController *tabBarC = [[UITabBarController alloc] init];

if ([[[UIDevice currentDevice] systemVersion] compare:@"5.0" options:NSNumericSearch] != NSOrderedAscending) {
    tabBarC.tabBar.selectedImageTintColor = [UIColor redColor];
}

请记住,仅适用于iOS5 +。

相关问题