added edgeInset
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
00edeac169
commit
bbdf496cda
@ -39,6 +39,14 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
||||
|
||||
open var userInfo = [String: Primitive]()
|
||||
|
||||
open var edgeInset: UIEdgeInsets = .zero {
|
||||
didSet {
|
||||
setNeedsUpdate()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override open var text: String? {
|
||||
didSet {
|
||||
attributes = nil
|
||||
@ -193,6 +201,15 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
||||
}
|
||||
}
|
||||
|
||||
open override func drawText(in rect: CGRect) {
|
||||
super.drawText(in: rect.inset(by: edgeInset))
|
||||
}
|
||||
|
||||
open override var intrinsicContentSize: CGSize {
|
||||
let size = super.intrinsicContentSize
|
||||
return CGSize(width: size.width + edgeInset.left + edgeInset.right, height: size.height + edgeInset.top + edgeInset.bottom)
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Actionable
|
||||
//--------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user