gpt4 book ai didi

background - 具有部分透明背景的 UITabbar

转载 作者:行者123 更新时间:2023-12-04 05:30:04 25 4
gpt4 key购买 nike

长期读者,第一次海报。请温柔点:P

我正在开发一个应用程序,并且有一个 UITabbar 元素的背景图像,它在顶部的几个像素是透明的。我进行了广泛的搜索,尝试了许多建议我可以找到的解决方案(将色调、背景颜色设置为 clearColor,将 alpha 设置为 0.2 等),但我仍然看到一条黑线,其中标签栏应该是透明的。我正在按如下方式设置背景(请参阅注释掉的行,以了解我尝试过但没有用的更多内容)

//[[UITabBar appearance] setBackgroundColor:[UIColor clearColor]];
//[self.view setBackgroundColor:[UIColor clearColor]];
//[super.view setBackgroundColor:[UIColor clearColor]];
//UITabBar.super.setBackgroundColor:[UIColor clearColor]];
[[UITabBar appearance] setBackgroundColor:[[UIColor alloc] initWithRed:0 green:0 blue:0 alpha:0.2]];
//[[UITabBar appearance] setTintColor:[UIColor blackColor]];
[[UITabBar appearance] setTintColor:[[UIColor alloc] initWithRed:0 green:0 blue:0 alpha:0.1]];
//[[UITabBar appearance] setAlpha:0.0];// setTintColor:[UIColor magentaColor]];
[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"tabbar.png"]];

截图可以在http://i.imgur.com/m1tW5.png找到

  • 该应用使用标签栏 Controller 。
  • 当我将背景颜色设置为白色或任何其他颜色时,黑线成功更改颜色,但一旦我将颜色设置为 clearColor,黑线就会恢复。
  • 当我隐藏整个标签栏时,它背后没有什么疯狂的东西,我可以成功地看到我应该看到的奶油色背景。
  • 图像是一个顶部透明的 png,如前所述,黑线出现在上面。

有人对我可能做错的地方有什么建议吗?

我们将不胜感激。

编辑:我使用的是 iOS 5.0,并不关心是否支持以前的 iOS 版本(以防打开任何其他潜在选择)。

最佳答案

我目前正在尝试解决类似的问题。

我认为黑色是:

  1. TabBars Superviews 背景 在这种情况下,您可以尝试设置 tabBars superviews 背景颜色。我这里没有我的 Mac,所以我无法尝试,而且我在您的“已尝试”代码中也没有看到这一点。

  2. 或者是tabBar的边框,可以改变tabBar边框的边框颜色。

    tabbar.frame.borderColor = [UIColor whiteColor];

您将需要导入 QuartzCore 框架来操作 boderColor。

如果有帮助,请告诉我。

关于background - 具有部分透明背景的 UITabbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12755921/

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