setting tint color for selected tab in UITabBar

流过昼夜 提交于 2019-12-05 03:27:05

I'm not seeing this with the latest Xcode 5 (5.0.2), but I do know that you want to call different methods to set the selected image tint color depending on whether you're running on iOS 6 or 7. Here's some sample code from one of my apps:

if ([RFSUtilities isIOS7OrHigher])
{
    [[UITabBar appearance] setTintColor:[UIColor whiteColor]];
}
else
{
    [[UITabBar appearance] setSelectedImageTintColor:[UIColor whiteColor]];
}

The +[RFSUtilities isIOS7OrHigher] just checks to see whether we're running on iOS 7 or above with the proper version check:

+ (BOOL)isIOS7OrHigher
{
    float versionNumber = floor(NSFoundationVersionNumber);
    return versionNumber > NSFoundationVersionNumber_iOS_6_1;
}

Hope this helps!

Just add tintColor with color type in User Defined Runtime Attribute of the UITabBar class.

Still looking for the similar approach for inactive tabs... Anyone know?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!