Reputation: 61
I am a iOS newbie. I don't know how to make UIView transparent. Please give me instructors (It's good if having code sample ). Example:
UIView * view = [[UIView alloc] init];
[view setTransparent];
Many thanks
Upvotes: 3
Views: 4634
Reputation: 57
bgView.backgroundColor = UIColor.white.withAlphaComponent(0.4)
try this
Upvotes: 1
Reputation: 2307
You can either set the background color to clear:
view.backgroundColor = UIColor.clearColor()
This will only make the background transparent (so if you have any subviews they will still be visible).
Or you could set the alpha property to 0:
view.alpha = 0
This will make not only that view transparent, but also any subviews also.
Upvotes: 5