Search code examples
iosswiftxcodealphaxcode-storyboard

My View is transparent, how can I make the components not transparent


I have a view controller with a couple of container views. These views are .8 alpha, so they are a little transparent. Each view has a few text-fields and some other UI (switches, segmented controls etc).
Now, as I load this I notice everything has that 0.8 alpha transparency. Is there a way to remove the transparency from the objects that are inside the view? I tried setting a background individually to each textbox with no alpha component (via storyboard) but they still retain that semi-transparency from their parent view.


Solution

  • Give opacity 80% to background color and not change alpha of your parent view.

    If you change alpha of your parent view it affects to all your child views. So, all your child view also looks transparent. But if you change background color opacity of your parent view it looks transparent and not affects to child views.

    enter image description here

    Example

    enter image description here