1

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

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

but before using it I read some posts about apple's app rejection due to this issue. I assume that if is an ios5 method must now be accepted. Is it true? Thanks.

Jaume
  • 913
  • 2
  • 17
  • 31

3 Answers3

9

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

Community
  • 1
  • 1
Nick Lockwood
  • 40,865
  • 11
  • 112
  • 103
  • thanks, so is there any way that people that runs under iOS4 could download the app but this method will not be executed and instead show always default blue color? possible? – Jaume Feb 05 '12 at 11:42
  • awesome solution, tested and working! really useful, thanks again – Jaume Feb 05 '12 at 12:26
0

I didn't try it myself but I took a look at the UITabBar Class Reference. The property selectedImageTintColor is documented. So this means, you are allowed to use it. Normally Apple only rejects application that use undocumented (not public) APIs. So you are safe to use it.

You can see there too that the property is available in iOS 5 and later.

Sandro Meier
  • 3,071
  • 2
  • 32
  • 47
0

You can check this post on how to determine the current iOS version and do the appropriate tab bar item color setting for users running iOS 5 or lower. Hope this helps.

Community
  • 1
  • 1
batman
  • 1,937
  • 2
  • 22
  • 41
  • Using instancesRespondToSelector: (see my answer) to check if the method exists is a better approach than testing the iOS version. That means you don't need to keep track of exactly which iOS version introduced each feature. – Nick Lockwood Feb 05 '12 at 12:32