iOS change tabbar item color is safe?

前端 未结 3 743
不知归路
不知归路 2021-01-07 07:24

I am properly using following method to change tabbar icon color,

[tabBarController.tabBar setSelectedImageTintColor:[UIColor redColor]];

b

3条回答
  •  时光取名叫无心
    2021-01-07 08:14

    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.

    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]];
    }
    

    This code is safe to run on iOS4.

    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

提交回复
热议问题