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.
|
// Resolves text layout issues found between both dynamically sized labels, number is not exact but performs as required.
|
||||||
if leftTextLabel.hasText && rightTextLabel.hasText {
|
if leftTextLabel.hasText && rightTextLabel.hasText {
|
||||||
rightTextLabel.preferredMaxLayoutWidth = floor((size - 16) * 0.4)
|
let padding = MFStyler.defaultHorizontalPadding(forSize: size) * 2
|
||||||
} else if rightTextLabel.hasText {
|
let maximumTextWidth = (size - (padding + 16 + layoutMargins.left + layoutMargins.right)) * 0.4
|
||||||
rightTextLabel.preferredMaxLayoutWidth = 0.0
|
rightTextLabel.preferredMaxLayoutWidth = round(maximumTextWidth)
|
||||||
|
} else {
|
||||||
|
rightTextLabel.preferredMaxLayoutWidth = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,6 +146,9 @@ import Foundation
|
|||||||
|
|
||||||
deactivateMiddleConstraint()
|
deactivateMiddleConstraint()
|
||||||
constrainBothLabels()
|
constrainBothLabels()
|
||||||
|
leftTextLabel.text = ""
|
||||||
|
rightTextLabel.text = ""
|
||||||
|
backgroundColor = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
private func deactivateMiddleConstraint() {
|
private func deactivateMiddleConstraint() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user