added edgeInsets
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
838a68348a
commit
0460e10b89
@ -33,10 +33,12 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
|
|
||||||
open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }}
|
open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
|
open var edgeInsets: UIEdgeInsets { textStyle.edgeInsets }
|
||||||
|
|
||||||
open var textPosition: TextPosition = .left { didSet { setNeedsUpdate() }}
|
open var textPosition: TextPosition = .left { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var userInfo = [String: Primitive]()
|
open var userInfo = [String: Primitive]()
|
||||||
|
|
||||||
override open var text: String? {
|
override open var text: String? {
|
||||||
didSet {
|
didSet {
|
||||||
attributes = nil
|
attributes = nil
|
||||||
@ -114,6 +116,13 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
shouldUpdateView = true
|
shouldUpdateView = true
|
||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Overrides
|
||||||
|
//--------------------------------------------------
|
||||||
|
open override func drawText(in rect: CGRect) {
|
||||||
|
super.drawText(in: rect.inset(by: edgeInsets))
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
@ -134,7 +143,12 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
|
|
||||||
//set the attributed text
|
//set the attributed text
|
||||||
attributedText = mutableText
|
attributedText = mutableText
|
||||||
|
|
||||||
|
//get accessibility
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
|
|
||||||
|
//force a drawText
|
||||||
|
setNeedsDisplay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user