首页 > 其他分享 >如何只为 UIView 的左上角和右上角设置 cornerRadius?

如何只为 UIView 的左上角和右上角设置 cornerRadius?

时间:2023-03-03 11:46:04浏览次数:47  
标签:layer 右上角 cornerRadius 左上角 shadowPath UIView

有没有办法cornerRadius只设置 a 的左上角和右上角UIView

我尝试了以下操作,但最终再也看不到视图了。

UIView*view=[[UIViewalloc]initWithFrame:frame];

CALayer*layer=[CALayerlayer];
UIBezierPath*shadowPath=[UIBezierPathbezierPathWithRoundedRect:framebyRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)cornerRadii:CGSizeMake(3.0,3.0)];
layer.shadowPath=shadowPath.CGPath;
view.layer.mask=layer;



解答

http://www.stackoverflow.ink/posts/ru-he-zhi-wei-uiview-de-zuo-shang-jiao-he-you-shang-jiao-she-zhi-cornerradius/

标签:layer,右上角,cornerRadius,左上角,shadowPath,UIView
From: https://www.cnblogs.com/silva/p/17175015.html

相关文章