Recently resigned from the last company, has been in the state of being unemployed, by the way home with the girl, today there is time, so write something, I hope that the beginning of contact with the development of the iOS small white can have some gains.
Fillet images are common in iOS development, but we usually set this up when we set the rounded corners of the picture:
Uiimageview *image = [[Uiimageview alloc]initwithframe:cgrectmake (100, 100, 50, 50)];
Image.layer.cornerRadius = 25.0;
Image.layer.masksToBounds = YES;
This setting, we feel there is nothing wrong, but also to achieve the demand (fillet), but when we first started to do iOS development, often ignore the performance of the problem, this is not anything, is starting from small white. This kind of setting, especially in the cell, if the number of cells is infinite, then it is very bad, then how to solve it, we can change the line. Of course this is only part of the solution:
Uiimageview *image = [[Uiimageview alloc]initwithframe:cgrectmake (100, 100, 50, 50)];
Image.layer.cornerRadius = 25.0;
Image.layer.masksToBounds = YES;
Image.layer.shouldRasterize = YES;
Image.layer.rasterizationScale =[uiscreen Mainscreen].scale;
First of all, I need to tell you about these two properties, Rasterizationscale this property and Shouldrasterize property, I directly from the API out of it, we look at (their English proficiency Limited, haha ha):
In simple terms:
When Shouldrasterize is set to Yes, UIView will be rendered as a bitmap and cached and will not be rendered again the next time it is used. If every time the page is rendered, then it consumes too much, if shouldrasterize = YES, the next time simply read the bitmap from the cache of the rendering engine, saving system resources.
You may not feel the advantage of the latter when you have a few rounded corners, but you will suddenly feel smooth when you have an infinite number of images in your cell that need to be rounded.
Correct posture for iOS picture fillet settings