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. // 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() {