How to change the highlighted color of a tabbaritem?
-
05-02-2021 - |
题
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 how 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.
不隶属于 StackOverflow