背景颜色的alpha不适用于iOS [英] alpha for background color not working in iOS

查看:178
本文介绍了背景颜色的alpha不适用于iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你知道为什么alpha参数在我的视图上不起作用吗?

Do you have any idea why alpha parameter does not work on my view ?

  self.view.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.4)

请同时查看此视频

视频

谢谢

推荐答案

如果您使用故事板并使用segue呈现视图控制器,则演示文稿显示带有透明背景的视图控制器的segue属性应该全屏显示,如附件所示。

If you are using storyboard and present view controller using segue, the presentation attribute of segue that show you view controller with transparent background should be over full screen as shown in attachment.

然后在视图控制器中设置背景颜色:

Then in your view controller set the background color by using this :

self.view.backgroundColor = UIColor(white: 0, alpha: 0.4)

这篇关于背景颜色的alpha不适用于iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆