I have to drop a shadow to the right and bottom of uiview.Im doing this in interface builder.But I see the shadow dropped to top of it.Tried differnt sizes.but couldn't get it.
layer.masksToBound=No
layer.shadowOpacity=0.15
layer.shadowRadius=2
layer.shadowOffSet={10,-10} //Values being set in Interfacebuilder.
Still this drops shadow at top.What should I do to get at bottom of view.
In Swift 3,
CGSizeMake
no longer exists. It has been changed toCGSize(width: 20, height: 10)
. So theshadowOffset
can be set like this in Swift 3:Hi I have used below code ,it will provide you with shadow you want.
Also masksToBounds is imp as it disables the clipping of sublayers that extend further than the view's bounds. If you put it YES then you won't see shadow as it clips sublayer where else in NO it allow to extent layer.
Try the following code, it might help you
I tested this code and it's working and output is:
I think your shadow offset is incorrect. It should be { 10 , 10} like:
I found out that these values give a nice result :