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 userInfo = [String: Primitive]()
|
||||||
|
|
||||||
|
open var edgeInset: UIEdgeInsets = .zero {
|
||||||
|
didSet {
|
||||||
|
setNeedsUpdate()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
override open var text: String? {
|
override open var text: String? {
|
||||||
didSet {
|
didSet {
|
||||||
attributes = nil
|
attributes = nil
|
||||||
@ -192,7 +200,16 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
attributedString.addAttribute( .paragraphStyle, value: paragraph, range: entireRange)
|
attributedString.addAttribute( .paragraphStyle, value: paragraph, range: entireRange)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// MARK: - Actionable
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user