use another stack

This commit is contained in:
Pfeil, Scott Robert 2020-04-01 10:20:55 -04:00
parent dccf576f7a
commit df16745911

View File

@ -19,14 +19,19 @@ import Foundation
let label3 = Label.commonLabelB2(true)
let label4 = Label.commonLabelB2(true)
let arrow = Arrow(frame: .zero)
let arrowAndLabel2Stack: Stack<StackModel>
//-----------------------------------------------------
// MARK: - Initializers
//-----------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
arrowAndLabel2Stack = Stack<StackModel>.createStack(with: [(view: arrow, model: StackItemModel(horizontalAlignment: .fill)),
(view: label2, model: StackItemModel(horizontalAlignment: .leading))],
axis: .horizontal, spacing: 4)
label2.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
label2.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
stack = Stack<StackModel>.createStack(with: [(view: label1, model: StackItemModel(percent: 19, horizontalAlignment: .leading)),
(view: arrow, model: StackItemModel(percent: 4, horizontalAlignment: .leading)),
(view: label2, model: StackItemModel(percent: 40, horizontalAlignment: .leading)),
(view: arrowAndLabel2Stack, model: StackItemModel(percent: 44, horizontalAlignment: .fill)),
(view: label3, model: StackItemModel(percent:17,horizontalAlignment: .leading)),
(view: label4, model: StackItemModel(percent:20,horizontalAlignment: .leading))],
axis: .horizontal,spacing: 8)
@ -44,6 +49,7 @@ import Foundation
super.setupView()
addMolecule(stack)
arrow.pinHeightAndWidth()
arrowAndLabel2Stack.restack()
stack.restack()
}