diff --git a/MVMCoreUI/Molecules/DesignedComponents/HeadersH1Button.swift b/MVMCoreUI/Molecules/DesignedComponents/HeadersH1Button.swift index 6e720fd4..7e600f7b 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/HeadersH1Button.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/HeadersH1Button.swift @@ -14,19 +14,23 @@ import Foundation //-------------------------------------------------- let headlineBody = HeadlineBody(frame: .zero) let button = PrimaryButton.button() - let stack = UIStackView() + var stack = Stack(frame: .zero) + var spacingBetwenHeadlineBodyAndButton: CGFloat = 72.0 //------------------------------------------------------- // MARK: - View Lifecycle //------------------------------------------------------- open override func setupView() { super.setupView() - stack.translatesAutoresizingMaskIntoConstraints = false - stack.addArrangedSubview(headlineBody) - stack.setCustomSpacing(72.0, after: headlineBody) - stack.addArrangedSubview(button) - stack.axis = .vertical - stack.alignment = .leading + stack = Stack.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .leading)), + (view: button, model: StackItemModel(spacing: spacingBetwenHeadlineBodyAndButton, horizontalAlignment: .leading))], axis: .vertical) + addSubview(stack) + NSLayoutConstraint.constraintPinSubview(toSuperview: stack) + } + + open override func updateView(_ size: CGFloat) { + super.updateView(size) + stack.updateView(size) } //---------------------------------------------------- @@ -37,6 +41,7 @@ import Foundation guard let model = model as? HeadersH1ButtonModel else { return } headlineBody.set(with: model.headlineBody, delegateObject, additionalData) button.set(with: model.button, delegateObject, additionalData) + stack.restack() } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {