Source —> MyBlog
- Solve the problem of using Masonry layout to obtain frame information in a timely manner
- Solve the failure problem caused by using border
- Instead of class methods, the use of more simple and convenient
- Note: if you have set up border and backgroundColor before you cancel, close masksToBounds (if it is turned on), please set it up in the method
SKArchCutter is an optional cutting angle of corner cutting tools, support UIView, UIImageView, UIButton and UILabel single tangential / angle / angle arch circle circle, and avoid the off screen rendering problems caused by the use of UIImageView system and ensure the fillet, the masksToBounds property of the layer object is always NO, so the performance of the use of a large number of projects in the round greatly optimized, the most important is the use of simple and convenient. If you feel good, star support under the bar
Why avoid screen rendering?
Although iOS 9 Apple Corp after the screen rendering done to deal with, but in fact we still need to consider the user before iOS 9, so it is necessary to deal with off screen rendering.
Here is not the first screen rendering too much to explain, on the screen rendering rendering, you can refer to this article
Let’s talk about the effects of off screen rendering:
If there is a large amount of off screen rendering occurs during the rolling process, it will seriously affect the frame rate.
So what’s the reason for off screen rendering:
The official disclosure of the information referred to as far as possible to avoid the effect of triggering off screen rendering: mask, shadow, group opacity, edge antialiasing. Use the rounded corner effect provided by the system will also trigger off screen rendering, such as:
imageView.layer.cornerRadius = 5
imageView.layer.masksToBounds = YES
Of course, the factors that can trigger off screen rendering are far more than the above.
What is the role of SKArchCutter?
- Convenient, quick to help you from any corner of the corner of the cutting (such as: semi-circular rectangle, only one corner of the rectangle is a rounded, rounded cut, etc.)
- Support UIView, UIImageView, UIButton and UILabel
- To avoid the problem caused by the system off screen rendering, to ensure that the masksToBounds property of the layer object is always NO, to improve the performance of a large number of rounded corners when used to reduce the consumption of CPU and GPU
- To avoid the delay due to the work of the thread, which led to the phenomenon of flashing pictures, where the idea of learning HJCornerRadius renderings
Ps: recorded frames have not screen sliding speed, smooth sliding illustrates how high
How to start
1 from GitHub on Clone–> SKArchCutter, and then view Demo
2 directly under the directory SKArchCutter copy to the project, or in the podfile folder to add pod’SKArchCutter’
3 feel good, then a star bar
Header file import
[SKArchCutter cuttingView:self.centerView cuttingDirection:UIRectCornerTopRight | UIRectCornerTopLeft cornerRadii:self.centerView.frame.size.height / 2 borderWidth:1 borderColor:[UIColor purpleColor] backgroundColor:[UIColor redColor]];
[SKArchCutter cuttingImageView:self.topImageView cuttingDirection:UIRectCornerAllCorners cornerRadii:self.topImageView.frame.size.height borderWidth:1 borderColor:[UIColor blackColor] backgroundColor:[UIColor clearColor]] / 2;