1. Draw rounded Corners
CornerView.layer.cornerRadius =; CornerView.layer.masksToBounds = YES;
Maskstobounds prevents child elements from spilling over the parent view.
If a square is to be set to a circle, the code is:
CornerView.layer.cornerRadius = CORNERVIEW.FRAME.SIZE.HEIGHT/2; CornerView.layer.masksToBounds = YES;
2. Draw the Border
BorderView.layer.borderWidth = 1.0; BorderView.layer.borderColor = [Uicolor blackcolor]. Cgcolor;
Note that Cgcolor is used instead of uicolor.
3. Draw Shadows
ShadowView.layer.shadowColor = [Uicolor Redcolor]. Cgcolor; ShadowView.layer.shadowOffset = Cgsizemake (5.0, 5.0); shadowView.layer.shadowOpacity = YES;
Offset is the shift offset, which is the direction in which the increment of the frame x, y coordinates is being expressed.
The opacity is transparent, and the default is 0, which means transparency. So we're going to set the opacity to 1 or yes, which means it's opaque, or it can be set to 0.5 or a similar value to be translucent.
Change the Uiimageview to rounded corners and circles