【发布时间】:2016-08-22 12:21:02
【问题描述】:
这是UILabel 的子类的外观:
@IBDesignable class AttributedLabel: UILabel {
@IBInspectable var padding: CGFloat = 0
override func drawTextInRect(rect: CGRect) {
super.drawTextInRect(UIEdgeInsetsInsetRect(rect, UIEdgeInsetsMake(padding, padding, padding, padding)))
}
}
我在情节提要中正确设置了padding,但它不起作用,因为填充仍然是0。
怎样做才能让它工作?是否可以在 Storyboard 中实时渲染?
【问题讨论】:
标签: ios swift uilabel ibdesignable