有没有办法cornerRadius只设置 a 的左上角和右上角UIView?
我尝试了以下操作,但最终再也看不到视图了。
UIView *view = [[UIView alloc] initWithFrame:frame]; CALayer *layer = [CALayer layer]; UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRoundedRect:frame byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight) cornerRadii:CGSizeMake(3.0, 3.0)]; layer.shadowPath = shadowPath.CGPath; view.layer.mask = layer;
文章介绍了如何使用CALayer和UIBezierPath来创建一个只在左上和右上角有圆角的UIView。通过设置shadowPath属性并应用到视图的layer.mask,可以实现特定角落的圆角效果,但要注意这可能导致视图在配置后变得不可见。
4235

被折叠的 条评论
为什么被折叠?



