iPhone Programming: Applying Alpha to Parent but not to Child Views

One simpler way is also possible without making the views siblings. Don’t set the alpha directly on the parent view. Instead use

[parentView setBackgroundColor:[[UIColor clearColor] colorWithAlphaComponent:0.5]];

Now any child view can have its own color and will NOT be transparent.

In Swift, this would be

parentView.backgroundColor = UIColor.clearColor().colorWithAlphaComponent(0.7)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)