Under the Bridge

Tip: UITabBar Tint

So you may have noticed that unlike most controls in UIKit, there’s no way to mess with the tint color of a UITabBar. But let’s say you really really want to make your UITabBar look different: well, from the people who brought you that nifty BarTint tool, here’s how to go about that:

CGSize tabBarSize = [tabBar frame].size;
tabBarFakeView = [[UIView alloc] initWithFrame:
CGRectMake(0,0,tabBarSize.width, tabBarSize.height)];
[tabBar insertSubview:tabBarFakeView atIndex:0];
[tabBarFakeView setBackgroundColor:[UIColor redColor]];

… and apparently the buttons will get drawn acceptably on top of whatever color/image/whatever you stick a view in there for. We’d be just a teensy little bit nervous that the SDK Police might consider this “undocumented API”, having encountered issues of that sort before, but hey, if somebody really really wants their UI to look just so, there you go!

0