且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iOS更改标签栏项目颜色是否安全?

更新时间:2023-09-18 23:49:34

它不会被拒绝,但您必须将部署目标设置为iOS 5, iOS 4将无法下载和安装您的应用程式。

It won't be rejected, but you'll have to set your deployment target to iOS 5 and people running iOS 4 won't be able to download and install your app.

要在iOS 5上使用这个方法,但仍允许应用程式在iOS 4上运作蓝色标签)执行此操作:

To use this method only on iOS 5, and still allow the app to work on iOS 4 (with blue tabs) do this:

if ([UITabBar instancesRespondToSelector:@selector(setSelectedImageTintColor:)])
{
    [tabBarController.tabBar setSelectedImageTintColor:[UIColor redColor]];
}

此代码可安全在iOS4上运行。

This code is safe to run on iOS4.

或者,请参阅我对此问题的回答,解释如何以适用于任何iOS版本的方式完全自定义选项卡图标颜色: 8939537> tabbar item image和selectedImage

Alternatively, see my answer to this question that explains how to fully customise the tab icon colours in a way that works on any iOS version: tabbar item image and selectedImage