Adding up the percentages for stacks.

This commit is contained in:
Subhankar Acharya 2020-02-14 17:46:56 +05:30
parent 0d6322b693
commit 21fc9c1802

View File

@ -37,16 +37,14 @@ import Foundation
contentView.addSubview(stack)
containerHelper.constrainView(stack)
}
//----------------------------------------------------
// MARK: - Molecule
//------------------------------------------------------
override open func reset() {
super.reset()
stack.reset()
}
 
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
super.setWithModel(model, delegateObject, additionalData)
guard let model = model as? ListRightVariablePaymentsModel else { return}
@ -54,9 +52,9 @@ import Foundation
rightImage.setWithModel(model.image, delegateObject, additionalData)
// Create a stack model to use for the internal stack and set the alignment of label and image
let leftLabel = StackItemModel()
let leftLabel = StackItemModel(percent: 70)
leftLabel.horizontalAlignment = .leading
let rightImage = StackItemModel()
let rightImage = StackItemModel(percent: 30)
rightImage.horizontalAlignment = .trailing
let stackModel = StackModel(molecules: [leftLabel,rightImage])
stackModel.axis = .horizontal