I have a background image on a ViewController. I also have two buttons inside two `UIView`s.

I want the views to be white with 0.5 opacity, but the buttons should have 1 opacity.

I have set the opacity on the `UIView`s like this:

```swift
myView.layer.opacity = 0.5

```

But this also gives the buttons the opacity of 0.5. When I place the buttons above the `UIView` in storyboard they automatically get embedded in the `UIView`.

How can I get 1 opacity on the buttons?

P.S. I have tried `myButton.layer.opacity = 1`

[![enter image description here](https://i.stack.imgur.com/XCFkg.png)](https://i.stack.imgur.com/XCFkg.png).

[![enter image description here](https://i.stack.imgur.com/QTIWQ.png)](https://i.stack.imgur.com/QTIWQ.png)