removed ui button default padding around UILabel

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-12-02 10:07:37 -06:00
parent 482ebc18a8
commit 5567c1174a
2 changed files with 10 additions and 4 deletions

View File

@ -89,7 +89,11 @@ open class TextLink: ButtonBase {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Overrides // MARK: - Overrides
//-------------------------------------------------- //--------------------------------------------------
open override var intrinsicContentSize: CGSize {
return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
}
open override func updateView() { open override func updateView() {
//need to set the properties so the super class //need to set the properties so the super class
//can render out the label correctly //can render out the label correctly

View File

@ -49,7 +49,7 @@ open class TextLinkCaret: ButtonBase {
get{ _text } get{ _text }
set { set {
var updatedText = newValue ?? "" var updatedText = newValue ?? ""
updatedText = iconPosition == .right ? "\(updatedText) " : " \(updatedText)" updatedText = iconPosition == .right ? "\(updatedText) " : " \(updatedText)"
_text = updatedText _text = updatedText
didChange() didChange()
} }
@ -89,7 +89,7 @@ open class TextLinkCaret: ButtonBase {
//-------------------------------------------------- //--------------------------------------------------
open override func setup() { open override func setup() {
super.setup() super.setup()
let size = caretView.size!.dimensions() let size = caretView.size!.dimensions()
caretView.frame = .init(x: 0, y: 0, width: size.width, height: size.height) caretView.frame = .init(x: 0, y: 0, width: size.width, height: size.height)
} }
@ -103,7 +103,9 @@ open class TextLinkCaret: ButtonBase {
// MARK: - Overrides // MARK: - Overrides
//-------------------------------------------------- //--------------------------------------------------
override open var intrinsicContentSize: CGSize { override open var intrinsicContentSize: CGSize {
let size = super.intrinsicContentSize //get the labels size, if not the button
let size = titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
var itemWidth = size.width var itemWidth = size.width
if let caretWidth = caretView.size?.dimensions().width { if let caretWidth = caretView.size?.dimensions().width {