user7781428
user7781428

Reputation:

Swift Alpha color

Im trying to put a view with labels above an image and apply a dark transparent color to my view but Xcode applies the alpha to the parent view and the child labels, how do I prevent that the labels inherit the alpha color from the parent view? I have tried several methods :/

enter image description here

enter image description here

enter image description here

Upvotes: 1

Views: 551

Answers (1)

JuicyFruit
JuicyFruit

Reputation: 2668

instead of setting UIView's alpha, set it's backgroundColor's alpha like

view.backgroundColor = UIColor(red: 250 / 255, green: 250 / 255, blue: 250 / 255, alpha: 1) //set alpha

you can't prevent inheritance.

Upvotes: 1

Related Questions