美文网首页
XIB给视图添加圆角

XIB给视图添加圆角

作者: 大海请带我走 | 来源:发表于2022-12-05 15:09 被阅读0次

在Key Path添加:
layer.cornerRadius (Type 应该设置为 Number)
layer.masksToBounds (Type 应该设置为 Boolean , 当右侧为☑️时为YES)
layer.borderWidth 设置边框宽度, 设置成String/Number
layer.borderColorFromUIColor 设置边框颜色,设置成Color

注意:经过测试,UILabel 必须设置设置 masksToBounds 这一键值对,才会出现圆角效果;UIButton、UIView、UIImageView 只需设置 layer.cornerRadius 这一键值对就可实现圆角效果

相关文章

网友评论

      本文标题:XIB给视图添加圆角

      本文链接:https://www.haomeiwen.com/subject/sbcifdtx.html