我试图setSelectedImageTintColor
在 iOS 7 中,但它不起作用。这是我的代码AppDelegate.m
under 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
被完全忽略。无法对未选择的选项卡图像进行着色。
See a Apple 开发者论坛上的讨论对这个。
请提交一份向 Apple 报告错误.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)