简体   繁体   中英

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.

How can this be done ? Thanks

Use alpha

self.contentView.alpha = 0.1

If alpha = 1.0 then the view is opaque, you can also set it to 0.

for that view do the following :

thatView.backgroundColor = UIColor.clearColor()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM