Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the local fillet problem of controls in ios development

Shulou Source: shulou.com Published: 2022-06-01 04:19:00 10月02日 Update

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!

Tags: Rounded corners controls problems parts development articles two location right done size what to do more knowledge industry information information channels paths channels help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Xiaomi Shulou Technology Apple Shulou Tech Info