diff --git a/MVMCoreUI/Atoms/Buttons/PrimaryButton.h b/MVMCoreUI/Atoms/Buttons/PrimaryButton.h index fb93c33a..771f8c01 100644 --- a/MVMCoreUI/Atoms/Buttons/PrimaryButton.h +++ b/MVMCoreUI/Atoms/Buttons/PrimaryButton.h @@ -62,8 +62,8 @@ static CGFloat const PrimaryButtonSmallHeight = 30.0; + (nullable instancetype)primaryGraySmallRedButton; + (nullable instancetype)primaryWhiteSmallRedButton; - - +// Returns the current height of the button. +- (CGFloat)getHeight; #pragma mark - For Subclassing diff --git a/MVMCoreUI/Atoms/Buttons/PrimaryButton.m b/MVMCoreUI/Atoms/Buttons/PrimaryButton.m index 5a708f2c..fd7ad2b9 100644 --- a/MVMCoreUI/Atoms/Buttons/PrimaryButton.m +++ b/MVMCoreUI/Atoms/Buttons/PrimaryButton.m @@ -86,6 +86,10 @@ #pragma mark - Sizing +- (CGFloat)getHeight { + return self.height.constant; +} + - (MFSizeObject *)innerPadding { return [MFSizeObject sizeObjectWithStandardSize:24.0 standardiPadPortraitSize:32.0 iPadProLandscapeSize:36.0]; } diff --git a/MVMCoreUI/Molecules/TwoButtonView.swift b/MVMCoreUI/Molecules/TwoButtonView.swift index 9e6cf4ee..ee03ff49 100644 --- a/MVMCoreUI/Molecules/TwoButtonView.swift +++ b/MVMCoreUI/Molecules/TwoButtonView.swift @@ -41,11 +41,7 @@ import UIKit } let primaryButtonMap = json?.optionalDictionaryForKey("primaryButton") let secondaryButtonMap = json?.optionalDictionaryForKey("secondaryButton") - setupUI(withPrimaryButtonMap: primaryButtonMap, secondaryButtonMap: secondaryButtonMap, legacy: false) - primaryButton?.setAsStandardCustom() - secondaryButton?.setAsSecondaryCustom() - primaryButton?.setWithJSON(primaryButtonMap, delegate: delegate, additionalData: additionalData) - secondaryButton?.setWithJSON(secondaryButtonMap, delegate: delegate, additionalData: additionalData) + set(primaryButtonJSON: primaryButtonMap, secondaryButtonJSON: secondaryButtonMap, actionDelegate: delegate, additionalData: additionalData, buttonDelegate: delegate) } // MARK: - Constraining @@ -141,6 +137,14 @@ import UIKit } } + open func set(primaryButtonJSON: [AnyHashable: Any]?, secondaryButtonJSON: [AnyHashable: Any]?, actionDelegate: NSObjectProtocol?, additionalData: [AnyHashable: Any]?, buttonDelegate: Any?) { + setupUI(withPrimaryButtonMap: primaryButtonJSON, secondaryButtonMap: secondaryButtonJSON, legacy: false) + primaryButton?.setAsStandardCustom() + secondaryButton?.setAsSecondaryCustom() + primaryButton?.setWithJSON(primaryButtonJSON, delegate: actionDelegate as? NSObject, additionalData: additionalData) + secondaryButton?.setWithJSON(secondaryButtonJSON, delegate: actionDelegate as? NSObject, additionalData: additionalData) + } + // MARK: - Legacy open func setup(withButtonMap buttonMap: [AnyHashable: Any]?, actionDelegate: NSObjectProtocol?, additionalData: [AnyHashable: Any]?, buttonDelegate: Any?) { let secondaryButtonMap = buttonMap?.optionalDictionaryForKey(KeySecondaryButton)