Jau*_*me 1 xcode cocoa-touch objective-c ios ios5
我正在使用以下方法来更改tabbar图标颜色,
[tabBarController.tabBar setSelectedImageTintColor:[UIColor redColor]];
Run Code Online (Sandbox Code Playgroud)
但在使用它之前,我读了一些关于苹果应用程序拒绝的帖子,因为这个问题.我假设现在必须接受ios5方法.这是真的吗?谢谢.
它不会被拒绝,但您必须将部署目标设置为iOS 5,并且运行iOS 4的人将无法下载和安装您的应用.
要仅在iOS 5上使用此方法,并且仍允许该应用在iOS 4上工作(使用蓝色标签),请执行以下操作:
if ([UITabBar instancesRespondToSelector:@selector(setSelectedImageTintColor:)])
{
[tabBarController.tabBar setSelectedImageTintColor:[UIColor redColor]];
}
Run Code Online (Sandbox Code Playgroud)
此代码可以安全地在iOS4上运行.
或者,请参阅我对此问题的回答,该问题解释了如何以适用于任何iOS版本的方式完全自定义选项卡图标颜色:tabbar项目图像和selectedImage