0

I'm currently designing an APP for the iphone and am searching for a way to create different selection images for each icon. I've found how to just create a single selection image for the entire UItabbar, but nothing about multiple selection images. Example when you click on "news" i want the bg blue, for "announcements" red, and so on. Is this possible

matt
  • 1
  • 1
  • Maybe you can provide some mock ups? It is hard to understand what you are trying to do... – Chris Wagner May 20 '13 at 19:56
  • I'm not able to post images, I don't have a 10 reputation. may be I can explain a little clearer. I'm wanting to have different "selection indicators" for each icon. So when you click "news" it goes from a grey bg to a blue bg, then when you click "ann" it goes from grey to Orange. Right now the selection indicator is blue, I was hoping to add 3 seperate ones. I mean I could just have the icons change colors, but was opening to have the whole selection change. – matt May 20 '13 at 20:26
  • Here is snippet of my code [[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"tabbar_selected_blue.png"]]; I guess i'm looking for a way to set this on each separate view controller – matt May 20 '13 at 20:30
  • You will probably need to do some custom drawing like described here, http://stackoverflow.com/questions/571028/changing-tint-background-color-of-uitabbar, but for the UITabBarItem. – Chris Wagner May 20 '13 at 20:34

1 Answers1

0

You can use the following method:

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item

That should help you identify which TabBar button was tapped by the item variable (i.e. by item.title) and based on that modify the TabBar's backgroundImage

To be able to use it don't forget to assign UITabBar's delegate to the view it's contained within and include <UITabBarDelegate> in your class header interface declaration.

Walter R
  • 523
  • 1
  • 7
  • 10