Fix to two button view

This commit is contained in:
Pfeil, Scott Robert 2019-08-29 10:19:28 -04:00
parent 3234a6ee7e
commit 3e426cb80b

View File

@ -8,12 +8,13 @@
import UIKit import UIKit
@objcMembers open class TwoButtonView: ButtonView { @objcMembers open class TwoButtonView: ViewConstrainingView {
open var secondaryButton: PrimaryButton? open var primaryButton: PrimaryButton? = PrimaryButton.button()
open var secondaryButton: PrimaryButton? = PrimaryButton.button()
open var viewForButtons: UIView? open var viewForButtons: UIView?
public var heightConstraint: NSLayoutConstraint? public var heightConstraint: NSLayoutConstraint?
public override init() { public init() {
super.init(frame: .zero) super.init(frame: .zero)
} }
@ -34,25 +35,32 @@ import UIKit
open override func updateView(_ size: CGFloat) { open override func updateView(_ size: CGFloat) {
super.updateView(size) super.updateView(size)
MVMCoreDispatchUtility.performBlock(onMainThread: { MVMCoreDispatchUtility.performBlock(onMainThread: {
self.primaryButton?.updateView(size)
self.secondaryButton?.updateView(size) self.secondaryButton?.updateView(size)
}) })
} }
open override func setupView() {
super.setupView()
setupButton()
}
// MARK: - MVMCoreUIMoleculeViewProtocol // MARK: - MVMCoreUIMoleculeViewProtocol
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
let primaryButtonMap = json?.optionalDictionaryForKey("primaryButton") let primaryButtonMap = json?.optionalDictionaryForKey("primaryButton")
let secondaryButtonMap = json?.optionalDictionaryForKey("secondaryButton") let secondaryButtonMap = json?.optionalDictionaryForKey("secondaryButton")
set(primaryButtonJSON: primaryButtonMap, secondaryButtonJSON: secondaryButtonMap, delegateObject: delegateObject, additionalData: additionalData) set(primaryButtonJSON: primaryButtonMap, secondaryButtonJSON: secondaryButtonMap, delegateObject: delegateObject, additionalData: additionalData)
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
} }
open override func reset() { open override func reset() {
super.reset() super.reset()
primaryButton?.setAsStandardCustom()
secondaryButton?.setAsSecondaryCustom() secondaryButton?.setAsSecondaryCustom()
} }
// MARK: - Constraining // MARK: - Constraining
override func setupButton() { func setupButton() {
setupWithTwoButtons() setupWithTwoButtons()
} }