If you want to create a UIView in your iOS app, that both have a drop shadow, and rounded corners, you have to do some magic with the view layers. In order to make rounded corners, the view and/or layer will have to set maskToBounds = YES, which will cause a shadow in the same layer to disappear, as the shadow needs to go beyond than the view bounds.
To achieve both a drop shadow and rounded corners, a solution could be to create 2 different layers and added them to your view. The following code assumes that we’re in a UIView object/class:
1 2 3 4 5 6 7 8 9
Next we create the layer that will create the rounded corners on the view:
1 2 3 4 5 6
This should create the wanted effect of having both a shadow and rounded corners on the UIView.