Today, you just need to add a view with rounded corners. I searched online. Find the following two methods.
1. Set directly (tested)
The header file must be imported first.
# Import <quartzcore/quartzcore. h>
...
Bgview. layer. cornerradius = cornerradiusinpixels;
Bgview. layer. maskstobounds = yes;
Bgview. opaque = no;
2. Draw in drawrect (not tested)
...
Cgfloat radius = 20.0;
Cgcontextref context = uigraphicsgetcurrentcontext ();
Cgcontextsetrgbstrokecolor (context, 1.0, 1.0, 1.0, 1 );
Cgfloat Minx = cgrectgetminx (rect), midx = cgrectgetmidx (rect), Maxx = cgrectgetmaxx (rect );
Cgfloat miny = cgrectgetminy (rect), midy = cgrectgetmidy (rect), Maxy = cgrectgetmaxy (rect );
Cgcontextmovetopoint (context, Minx, midy );
Cgcontextaddarctopoint (context, Minx, miny, midx, miny, radius );
Cgcontextaddarctopoint (context, Maxx, miny, Maxx, midy, radius );
Cgcontextaddarctopoint (context, Maxx, Maxy, midx, Maxy, radius );
Cgcontextaddarctopoint (context, Minx, Maxy, Minx, midy, radius );
Cgcontextclosepath (context );
Cgcontextdrawpath (context, kcgpathfill );