Merge branch 'bugfix/label_stack_list_layout' into 'develop'

Bugfix/label stack list layout

See merge request BPHV_MIPS/mvm_core_ui!461
This commit is contained in:
Pfeil, Scott Robert 2020-05-22 16:34:51 -04:00
commit 771fde7c8b
2 changed files with 8 additions and 4 deletions

View File

@ -677,9 +677,6 @@ public typealias ActionBlock = () -> ()
@objc public func updateView(_ size: CGFloat) {
scaleSize = size as NSNumber
// This fixes a defect for when there are multiple labels stacked in a list item. Sometime some labels will not fill their available space.
preferredMaxLayoutWidth = size
if let originalAttributedString = originalAttributedString {
let attributedString = NSMutableAttributedString(attributedString: originalAttributedString)
attributedString.removeAttribute(.font, range: NSRange(location: 0, length: attributedString.length))

View File

@ -21,7 +21,7 @@ import Foundation
//--------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .fill)),
(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading))],
(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .fill))],
axis: .horizontal)
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
@ -35,6 +35,7 @@ import Foundation
//--------------------------------------------------
override open func setupView() {
super.setupView()
leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
addMolecule(stack)
stack.restack()
}
@ -57,4 +58,10 @@ import Foundation
super.reset()
leftLabel.styleTitle2XLarge(true)
}
open override func layoutSubviews() {
super.layoutSubviews()
// This fixes a defect body text where it doesn't layout correctly.
eyebrowHeadlineBodyLink.body.preferredMaxLayoutWidth = eyebrowHeadlineBodyLink.frame.width
}
}