iOS -xib-圆角

2023-08-14  本文已影响0人  ios_暗夜行者

详细步骤介绍

点击UI控件

点击 Xcode 右侧上方身份检查器(左起第三个按钮)

找到 Runtime Attributes 属性,通过Key Path 和 Value 进行设置

设置圆角需要到的Key Path:

layer.cornerRadius ,注意该 key 对应 Value 的 type 应该设置为 String

layer.masksToBounds ,注意该 key 对应 Value 的 type 应该设置为 Boolean , 当右侧出现对号时为YES

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

 

来源链接:https://www.jianshu.com/p/3f6a4343139e

上一篇 下一篇

猜你喜欢

热点阅读