setSelectedImageTintColor在iOS 7中不起作用

前端之家收集整理的这篇文章主要介绍了setSelectedImageTintColor在iOS 7中不起作用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图在iOS 7中setSelected ImageTintColor,但它不工作.这是我在AppDelegate.m中的didFinishLaunchingWithOptions下的代码
UITabBarController *tabBarController = (UITabBarController *) self.window.rootViewController;
UITabBar *tabBar = tabBarController.tabBar;

for (UITabBarItem *item in tabBar.items)
    {
        UIImage *image = item.image;
        UIImage *correctImage = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
        item.image = correctImage;
    }

[[UITabBar appearance] setTintColor:[UIColor whiteColor]];
[[UITabBar appearance] setSelectedImageTintColor:[UIColor colorWithRed:44.0/255.0 green:176.0/255.0 blue:28.0/255.0 alpha:1.0]];
[[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:51.0/255.0 green:51.0/255.0 blue:51.0/255.0 alpha:1.0]];

它仍然不会显示selectedImageTintColor.选择时为白色;灰色未选择.我究竟做错了什么?

解决方法

这是iOS 7中的已知问题.tintColor用于所选标签图像. selectedImageTintColor完全被忽略.没有办法调整未选择的选项卡图像.

看到这个discussion on the Apple Developer Forums.

请提交bug report with Apple.

原文链接:https://www.f2er.com/iOS/330373.html

猜你在找的iOS相关文章