【发布时间】:2015-01-15 12:20:52
【问题描述】:
我想要在我的UIButton 周围有一个扁平的白色边框。我希望它在故事板中或以编程方式。我的代码不起作用。
代码:
UIButton.layer.cornerRadius = 2;
UIButton.layer.borderWidth = 1;
UIButton.layer.borderColor = UIColor.whiteColor()
【问题讨论】:
-
你能详细说明“不工作”吗?是因为您试图在 UIButton 类而不是该类的实例上设置属性吗?
-
UiButton.type 没有名为 layer 的成员是错误
-
对,UIButton 类型没有您要访问的属性。你需要一个类的实例。
-
但是in this webpage这个类已经被使用了
-
我也导入了 QuartzCore