1

I have a custom tabbar with custom tabbar items. Everything works as I want it to, besides when a tap has been tapped and is in a selected state, it does not use my custom highlighted background if re-tapped.

So far I set:

    UIButton *tap = [UIButton buttonWithType:UIButtonTypeCustom];
    [tap setBackgroundImage:img forState:UIControlStateNormal];
    [tap setBackgroundImage:[UIImage imageNamed:@"img_down"] forState:UIControlStateHighlighted];
    [tap setBackgroundImage:[UIImage imageNamed:@"img_down"] forState:UIControlStateSelected];

I've read that I may need to use the UITabBarDelegate. Any ideas?

andershqst
  • 1,454
  • 1
  • 14
  • 24

2 Answers2

0

I needed to set:

    [tap setBackgroundImage:[UIImage imageNamed:@"img_down"] forState:(UIControlStateHighlighted|UIControlStateSelected)];;

Check this SO post for details

Community
  • 1
  • 1
andershqst
  • 1,454
  • 1
  • 14
  • 24
0
[tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"star.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"star22.png"]];

change two images

lesyk
  • 3,979
  • 3
  • 25
  • 39
  • If tabBarItem is of type UITabBarItem, this does not answer my question, which deals with a UIButton. Answer to my own question is above. – andershqst Jun 08 '12 at 23:09