further attention paid to the preferredMaxLayout.
This commit is contained in:
parent
52bfb1a8d1
commit
f23cee6ba9
@ -71,9 +71,11 @@ import Foundation
|
||||
|
||||
// Resolves text layout issues found between both dynamically sized labels, number is not exact but performs as required.
|
||||
if leftTextLabel.hasText && rightTextLabel.hasText {
|
||||
rightTextLabel.preferredMaxLayoutWidth = floor((size - 16) * 0.4)
|
||||
} else if rightTextLabel.hasText {
|
||||
rightTextLabel.preferredMaxLayoutWidth = 0.0
|
||||
let padding = MFStyler.defaultHorizontalPadding(forSize: size) * 2
|
||||
let maximumTextWidth = (size - (padding + 16 + layoutMargins.left + layoutMargins.right)) * 0.4
|
||||
rightTextLabel.preferredMaxLayoutWidth = round(maximumTextWidth)
|
||||
} else {
|
||||
rightTextLabel.preferredMaxLayoutWidth = 0
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,6 +146,9 @@ import Foundation
|
||||
|
||||
deactivateMiddleConstraint()
|
||||
constrainBothLabels()
|
||||
leftTextLabel.text = ""
|
||||
rightTextLabel.text = ""
|
||||
backgroundColor = nil
|
||||
}
|
||||
|
||||
private func deactivateMiddleConstraint() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user