updated intrinsicContentSize
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
552de21ec0
commit
7cc64b2a23
@ -44,9 +44,15 @@ open class BreadcrumbItem: ButtonBase {
|
|||||||
|
|
||||||
/// The natural size for the receiving view, considering only properties of the view itself.
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
open override var intrinsicContentSize: CGSize {
|
open override var intrinsicContentSize: CGSize {
|
||||||
return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
|
guard let titleLabel else { return super.intrinsicContentSize }
|
||||||
|
// Calculate the titleLabel's intrinsic content size
|
||||||
|
let labelSize = titleLabel.sizeThatFits(CGSize(width: self.frame.width, height: CGFloat.greatestFiniteMagnitude))
|
||||||
|
// Adjust the size if needed (add any additional padding if your design requires)
|
||||||
|
let adjustedSize = CGSize(width: labelSize.width + contentEdgeInsets.left + contentEdgeInsets.right,
|
||||||
|
height: labelSize.height + contentEdgeInsets.top + contentEdgeInsets.bottom)
|
||||||
|
return adjustedSize
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user