How to solve the local fillet problem of controls in ios development
Editor to share with you how to solve the local fillet problem of the control in ios development. I hope you will get something after reading this article. Let's discuss it together.
The problem of local fillet of control
Have you ever encountered the same problem, a button or label, as long as the two corners on the right, or just one fillet? What to do. We need a layer mask to help us.
CGRect rect = CGRectMake (0,0,100,50); CGSize radio = CGSizeMake (5,5); / / fillet size UIRectCorner corner = UIRectCornerTopLeft | UIRectCornerTopRight;// fillet position UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:corner cornerRadii:radio]; CAShapeLayer * masklayer = [[CAShapeLayer alloc] init]; / / create shapelayer masklayer.frame = button.bounds; masklayer.path = path.CGPath;// setting path button.layer.mask = masklayer
For example, button, other controls that inherit from UIView can
After reading this article, I believe you have a certain understanding of "how to solve the local fillet problem of controls in ios development". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!