Tyler Rolfe Tyler Rolfe - 3 months ago 47
Swift Question

UIView background color changing when view controller finishes loading

I'm loading a view controller modally via another view controller and I'm trying to change the background color using:

override func viewDidLoad() {

transparentBG.backgroundColor? = UIColor.black.withAlphaComponent(0.4)

// transparentBG is a UIView defined in storyboard

While the view is animating into position (sliding up) it maintains the alpha value I set. But once it reaches the top of the screen it removes the alpha component and is changing the color to what looks like the color with the alpha component, so like a gray color, but with no transparency as seen in the image below.

enter image description here

Is there anyway to maintain the alpha component after if finishes loading?


Step one: Change this to an overFullScreen presentation.

Step two: There is no step two.