This article reprinted to http://sjh787291806.blog.163.com/blog/static/21396319620131015105856616/
If you need to have all of the 4 corners of the UIView rounded, it is fairly straightforward to set the Cornerradius property of its layer (the project needs to use the Quartzcore framework). This method is not good when you want to specify a few corners (less than 4) to be rounded and the other constant.
For this scenario, several solutions are available on StackOverflow. One of the simplest and most elegant schemes is the use of Uibezierpath. A sample code is given below.
UIView *View2 = [[UIView Alloc] initWithFrame:CGRectMake( -, Ten, the, the)];View2.BackgroundColor = [Uicolor Redcolor];[ Self.View Addsubview:View2]; Uibezierpath *Maskpath = [Uibezierpath Bezierpathwithroundedrect:View2.bounds byroundingcorners:Uirectcornerbottomleft | Uirectcornerbottomright cornerradii:Cgsizemake(Ten, Ten)];Cashapelayer *Masklayer = [[Cashapelayer Alloc] Init];Masklayer.Frame = View2.bounds;Masklayer.Path = Maskpath.Cgpath;View2.Layer.Mask = Masklayer;
which
byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
Specifies the corners that need to be rounded corners. The parameter is of type Uirectcorner , and the optional values are:
* UIRectCornerTopLeft* UIRectCornerTopRight* UIRectCornerBottomLeft* UIRectCornerBottomRight* UIRectCornerAllCorners
From the name it is easy to see the meaning of the representative, using the "|" To mix it up just fine.