gpt4 book ai didi

ios - 透明的 UITabBar

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:01:36 25 4
gpt4 key购买 nike

我已经对 UITabBar 进行了子类化,我需要它是透明的。像这样:enter image description here

我试过:[[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:79.0f/255.0 green:53.0f/255.0 blue:98.0f/255.0 alpha:0.6f]];

只是改变了条形的颜色,但条形仍然不透明。

请帮忙。我尝试了很多不同的方法,但都没有奏效。

最佳答案

试试这个

//  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];

这是结果

enter image description here

关于ios - 透明的 UITabBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27589797/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com