您知道为什么 alpha 参数在我的 View 中不起作用吗?
self.view.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.4)
请同时查看此视频
谢谢
最佳答案
如果您正在使用 Storyboard并使用 segue 显示 View Controller ,则向您显示具有透明背景的 View Controller 的 segue 的 presentation 属性应该在全屏上显示,如附件所示。
然后在你的 View Controller 中使用这个设置背景颜色:
self.view.backgroundColor = UIColor(white: 0, alpha: 0.4)
关于ios - 背景颜色的 alpha 在 iOS 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28874737/