UIView的clearColor在IOS5 Xcode4.2中产生WhiteColor而不是Transparent

发布于 2024-12-13 19:16:18 字数 577 浏览 2 评论 0原文

自从我用 IOS 5 更新 Xcode 以来,我遇到了一个非常奇怪的问题...... 我无法将 UIView 的背景颜色设置为透明...

这是我能做的:!!

我可以将视图设置为任何颜色,绿色,蓝色,红色,它们都在 UIVIEW 上正确显示

    [self.view setBackgroundColor:[UIColor greenColor]];     // Working 100 % 

我可以设置背景图像//它也可以工作,

  [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"abc2010.png"]]]; // Working 100 %


  [self.view setBackgroundColor:[UIColor clearColor]];       // No Error but result is not what I need 

而不是透明背景,它始终是白色...!

我将不胜感激帮助解决问题! :)

I am facing a very strange issue ever since I updated the Xcode with IOS 5 ...
I can't able to set the background Color of UIView to Transparent ...

here is What I can do :!!

I can set the view to any color , green , blue , red and they are all shown correctly on UIVIEW

    [self.view setBackgroundColor:[UIColor greenColor]];     // Working 100 % 

I can set a background Image // it's Working too

  [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"abc2010.png"]]]; // Working 100 %


  [self.view setBackgroundColor:[UIColor clearColor]];       // No Error but result is not what I need 

instead of transparent Background , it is always WHITE ... !!

I'll appreciate the help in figuring out the problem!! :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空袭的梦i 2024-12-20 19:16:18

我刚刚遇到了同样的问题。这里有几件事要做。
首先,确保设置视图,使其不是不透明的:

[self.view setOpaque:NO];

其次,设置视图图层,使其也是清晰的颜色:

[self.view.layer setBackgroundColor:[UIColor clearColor]];

看看是否有帮助。它解决了我的问题,你的听起来和我的一样。
祝你好运。

I've just had this same problem. Here's a couple things to do.
Firstly, make sure you set the view so it's not opaque:

[self.view setOpaque:NO];

Second, set the views layer so it's also clearColor:

[self.view.layer setBackgroundColor:[UIColor clearColor]];

See if that helps. It fixed my problem, and your's sounds just like mine.
Good luck.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文