Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing shadow from subviews

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.

like image 355
Vervatovskis Avatar asked Sep 25 '13 20:09

Vervatovskis


1 Answers

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

like image 81
kuldip bhalodiya Avatar answered Dec 09 '22 11:12

kuldip bhalodiya