further attention paid to the preferredMaxLayout.

This commit is contained in:
Christiano, Kevin 2019-06-19 16:17:22 -04:00
parent 52bfb1a8d1
commit f23cee6ba9

View File

@ -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() {