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