Karolis Raišelis Karolis Raišelis - 1 year ago 107
iOS Question

Transparent UITabBar

I have subclassed

and I need it to be transparent. Like This: enter image description here

I have tried :
[[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:79.0f/255.0 green:53.0f/255.0 blue:98.0f/255.0 alpha:0.6f]];

It only changed The bar's color, but The bar is still not transparent.

Please help. I have tried lots of different methods, but none of them worked.

Answer Source

Try this

//  The color you want the tab bar to be
UIColor *barColor = [UIColor colorWithRed:79.0f/255.0 green:53.0f/255.0 blue:98.0f/255.0 alpha:0.6f];

//  Create a 1x1 image from this color
UIGraphicsBeginImageContext(CGSizeMake(1, 1));
[barColor set];
UIRectFill(CGRectMake(0, 0, 1, 1));
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

//  Apply it to the tab bar
[[UITabBar appearance] setBackgroundImage:image];

Here's the result

enter image description here