我已经子类UITabBar,我需要它是透明的。就像这样:

我试过了:[[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:79.0f/255.0 green:53.0f/255.0 blue:98.0f/255.0 alpha:0.6f]];
它只改变了酒吧的颜色,但酒吧仍然是不透明的。
请帮帮忙。我试过很多不同的方法,但都没有用。
发布于 2014-12-21 13:50:06
尝尝这个
// 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();
UIGraphicsEndImageContext();
// Apply it to the tab bar
[[UITabBar appearance] setBackgroundImage:image];这是结果

发布于 2017-07-21 18:35:00
下面是一个基于AnupamChugh的答案的解决方案

发布于 2016-08-09 13:38:16
UITabBar.appearance().backgroundColor=UIColor.clearColor()
UITabBar.backgroundImage = UIImage()https://stackoverflow.com/questions/27589797
复制相似问题