How to solve?
Rounded corners are handled using Uiimageview.
To put it simply, lay a uiimageview on the ground floor, and then use Graphicscontext to generate a picture with rounded corners.
@implementation UIImage (Roundedcorner)
-(UIImage *) Yal_imagewithroundedcornersandsize: (cgsize) SizeToFit Andcornerradius: (cgfloat) Radius
{
CGRect rect = (cgrect) {0.f, 0.f, sizetofit};
Uigraphicsbeginimagecontextwithoptions (SizeToFit, NO, UIScreen.mainScreen.scale);
Cgcontextaddpath (Uigraphicsgetcurrentcontext (),
[Uibezierpath Bezierpathwithroundedrect:rect Cornerradius:radius]. Cgpath);
Cgcontextclip (Uigraphicsgetcurrentcontext ());
[Self drawinrect:rect];
UIImage *output = Uigraphicsgetimagefromcurrentimagecontext ();
Uigraphicsendimagecontext ();
return output;
}
@end
In this way, you can avoid slowing down fps when a large number of cells are rendered off-screen.
Of course, if it's just one or two view with rounded corners, you don't need to do that. Set the Layer.cornerradius directly.
Processing of rounded corners optimization