[英]How to make a view become transparent to uncover background content?
I have set an image in background using this code: 我已经使用以下代码在后台设置了图像:
self.tableView.backgroundColor = UIColor(patternImage: UIImage(named: "image1")!)
However, I have some contentView on top, and I am trying to have those transparent to unveil the background. 但是,我在顶部有一些contentView,并且我试图使这些透明显示背景。
How can this be done ? 如何才能做到这一点 ? Thanks 谢谢
Use alpha
使用alpha
self.contentView.alpha = 0.1
If alpha = 1.0
then the view is opaque, you can also set it to 0. 如果alpha = 1.0
则视图是不透明的,您也可以将其设置为0。
for that view do the following : 对于该视图,请执行以下操作:
thatView.backgroundColor = UIColor.clearColor() thatView.backgroundColor = UIColor.clearColor()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.