1

I see that there is [tabBar setSelectedImageTintColor:[UIColor]] which is great, but how do I set the imagetintcolor for the offstate? I can't seem to find a [tabBar setImageTintColor] or [tabBar setUnSelectedImageTintColor].

John
  • 32,403
  • 80
  • 251
  • 422

3 Answers3

2

Take a look at the "Managing the Finished and Selected Image" task's section of the docs of UITabBarItem.

Mat
  • 7,613
  • 4
  • 40
  • 56
  • 1
    That doesn't address the issue of coloring of the image. – Andy Obusek Jun 02 '12 at 14:21
  • The docs of `selectedImageTintColor` clearly says: `If you want to also customize the unselected image appearance, you must sent setFinishedSelectedImage:withFinishedUnselectedImage: to individual tab bar items.` – Mat Jun 02 '12 at 14:26
  • 1
    PERFECT! This also had the bonus of helping me remove that nasty default gradient that appearred on the icons! – John Jun 02 '12 at 14:42
  • 1
    NOTE: "Deprecated in iOS 7.0. Use image and selectedImage with UIImageRenderingModeAlwaysOriginal instead." – Olie Sep 26 '13 at 01:45
1

And for a quick cut 'n paste:

NSArray *tabBarImages = [[NSArray alloc] initWithObjects:@"tab_a.png",
                         @"tab_b.png",
                         @"tab_c.png",
                         @"tab_d.png",
                         @"tab_e.png",
                         nil];


for (uint i=0;i<[_tabBarController.tabBar.items count];i++)
{
    UITabBarItem *uitbi = [_tabBarController.tabBar.items objectAtIndex:i];

    NSString *imageRef = [tabBarImages objectAtIndex:i];
    [uitbi setFinishedSelectedImage:[UIImage imageNamed:imageRef] withFinishedUnselectedImage:[UIImage imageNamed:imageRef]];

}
dijipiji
  • 3,063
  • 1
  • 26
  • 21
0

For changing the look and feel of the buttons to that level of detail, you are going to have to implement your own custom UITabBar. Here's a good reference:

http://idevrecipes.com/2010/12/16/raised-center-tab-bar-button/

Andy Obusek
  • 12,614
  • 4
  • 41
  • 62