How to change the highlighted color of a tabbaritem?
I am trying to change the highlighted color of the tabBarItem just like the Viber app does. I don't want to change the color of all the Bar, just the highlighted color.
I have read a lot posts here, but none of them explained how to do only this modification.
Does someone know ho开发者_运维百科w to do this? There is many apps that have customized colors!
Currently, with iOS4, this type of customization is not possible with a standard UITabBar. Most applications that have customized UITabBars actually create their own. Check out CocoaControls for some drop in third-party solutions you could use.
Have you tried:
UIView *bg = [[[UIView alloc] initWithFrame:CGRectMake(0,0,320,49)] autorelease];
[bg setBackgroundColor:[UIColor redColor]];
[self.tabBarController.tabBar insertSubview:bg atIndex:1];
That code initially creates a background view for the tabBar and sets it's colour to red.
精彩评论