Removing shadow from subviews
Asked Answered
U

1

6

I have a UIView mainView, I've added 4 buttons in each corners as subviews. I added shadow to my mainView like this

mainView.layer.shadowColor = [[UIColor blackColor] CGColor];
mainView.view.layer.shadowOffset = CGSizeMake(0,6);
mainView.layer.shadowOpacity = 0.3;

My problem is that subviews show shadows (the buttons) too. How to hide subviews shadows. Thanks in advance.

Uncommunicative answered 25/9, 2013 at 20:7 Comment(4)
This is peculiar. Have you tried to 'set' shadows on the subviews manually?Deviltry
yes I tried, I doesn't work unfortunatelyUncommunicative
what is mainview? How did you get view property for UIVIEw ?@UncommunicativeIroning
You can look for alternate solution. Something like this: #12359351Phip
G
1

I have also fetch the same problem and found the solution of this issue.

  • just set the background color for super view (Replace super view's background clear to any other color.)

EX: In above Questions

mainView.backgroundColor = UIColor.white

Groovy answered 23/5, 2017 at 13:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.