From b7556fdce949d3eeb3d75544a08ead42dbf4ba88 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 25 Mar 2019 09:57:47 -0400 Subject: [PATCH] merge --- MVMCoreUI.xcodeproj/project.pbxproj | 6 - MVMCoreUI/Molecules/PrimaryButtonView.h | 53 ---- MVMCoreUI/Molecules/PrimaryButtonView.m | 350 ------------------------ 3 files changed, 409 deletions(-) delete mode 100644 MVMCoreUI/Molecules/PrimaryButtonView.h delete mode 100644 MVMCoreUI/Molecules/PrimaryButtonView.m diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index b406d4f2..e16b61aa 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -32,7 +32,6 @@ D29770F321F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D29770EF21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; D29770F421F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D29770F021F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; D29770F521F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770F121F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.m */; }; - D29770F921F7C73800B2F0D0 /* PrimaryButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770F721F7C73800B2F0D0 /* PrimaryButtonView.m */; }; D29770FC21F7C77400B2F0D0 /* MVMCoreUITextFieldView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770FA21F7C77400B2F0D0 /* MVMCoreUITextFieldView.m */; }; D29770FD21F7C77400B2F0D0 /* MVMCoreUITextFieldView.h in Headers */ = {isa = PBXBuildFile; fileRef = D29770FB21F7C77400B2F0D0 /* MVMCoreUITextFieldView.h */; settings = {ATTRIBUTES = (Public, ); }; }; D29DF0D121E404D4003B2FB9 /* MVMCoreUI.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF0CF21E404D4003B2FB9 /* MVMCoreUI.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -187,8 +186,6 @@ D29770EF21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopLabelsAndBottomButtonsTableViewController.h; sourceTree = ""; }; D29770F021F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopLabelsAndBottomButtonsViewController.h; sourceTree = ""; }; D29770F121F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsAndBottomButtonsViewController.m; sourceTree = ""; }; - D29770F621F7C73800B2F0D0 /* PrimaryButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrimaryButtonView.h; sourceTree = ""; }; - D29770F721F7C73800B2F0D0 /* PrimaryButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrimaryButtonView.m; sourceTree = ""; }; D29770FA21F7C77400B2F0D0 /* MVMCoreUITextFieldView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUITextFieldView.m; sourceTree = ""; }; D29770FB21F7C77400B2F0D0 /* MVMCoreUITextFieldView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreUITextFieldView.h; sourceTree = ""; }; D29DF0CC21E404D4003B2FB9 /* MVMCoreUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MVMCoreUI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -422,8 +419,6 @@ D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */, D282AACA2243C61700C46919 /* ButtonView.swift */, D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */, - D29770F621F7C73800B2F0D0 /* PrimaryButtonView.h */, - D29770F721F7C73800B2F0D0 /* PrimaryButtonView.m */, D2A514662213885800345BFB /* StandardHeaderView.swift */, D2A5145C2211D22A00345BFB /* MVMCoreUIMoleculeViewProtocol.h */, D2A5145E2211DDC100345BFB /* MoleculeStackView.swift */, @@ -859,7 +854,6 @@ D282AAB4223FDDAE00C46919 /* MFLoadImageView.swift in Sources */, D29DF11721E6805F003B2FB9 /* UIColor+MFConvenience.m in Sources */, D29DF25321E6A177003B2FB9 /* MFDigitTextField.m in Sources */, - D29770F921F7C73800B2F0D0 /* PrimaryButtonView.m in Sources */, D29DF12F21E6851E003B2FB9 /* MVMCoreUITopAlertMainView.m in Sources */, D29DF17C21E69E1F003B2FB9 /* MFTextButton.m in Sources */, D29DF2C521E7BF57003B2FB9 /* MFTabBarSwipeAnimator.m in Sources */, diff --git a/MVMCoreUI/Molecules/PrimaryButtonView.h b/MVMCoreUI/Molecules/PrimaryButtonView.h deleted file mode 100644 index dbfd0c20..00000000 --- a/MVMCoreUI/Molecules/PrimaryButtonView.h +++ /dev/null @@ -1,53 +0,0 @@ -// -// PrimaryButtonView.h -// myverizon -// -// Created by Scott Pfeil on 12/11/15. -// Copyright © 2015 Verizon Wireless. All rights reserved. -// - -#import -#import -#import - -@interface PrimaryButtonView : ViewConstrainingView - -// Set when there is one button or it is the right button when there are two. -@property (nullable, weak, nonatomic) PrimaryButton *primaryButton; - -// The left button when there are two buttons. -@property (nullable, weak, nonatomic) PrimaryButton *secondaryButton; - -// Inits with a single button. -- (nonnull instancetype)initButtonSmall:(BOOL)small enabled:(BOOL)enabled; - -// Inits with two buttons. -- (nonnull instancetype)initWithTwoButtons; - -// Legacy: Sets up with whatever is in the passed in button map. (could be 0, 1, or 2 buttons) -- (nonnull instancetype)initButtonSmall:(BOOL)small buttonMap:(nullable NSDictionary *)buttonMap actionDelegate:(nullable NSObject *)actionDelegate additionalData:(nullable NSDictionary *)additionalData buttonDelegate:(nullable id )buttonDelegate; -- (nonnull instancetype)initWithPrimaryButtonMap:(nullable NSDictionary *)primaryButtonMap secondaryButtonMap:(nullable NSDictionary *)secondaryButtonMap actionDelegate:(nullable NSObject *)actionDelegate additionalData:(nullable NSDictionary *)additionalData buttonDelegate:(nullable id )buttonDelegate; -- (void)setupWithButtonMap:(nullable NSDictionary *)buttonMap actionDelegate:(nullable NSObject *)actionDelegate additionalData:(nullable NSDictionary *)additionalData buttonDelegate:(nullable id )buttonDelegate; -- (void)setupWithPrimaryButtonMap:(nullable NSDictionary *)primaryButtonMap secondaryButtonMap:(nullable NSDictionary *)secondaryButtonMap actionDelegate:(nullable NSObject *)actionDelegate additionalData:(nullable NSDictionary *)additionalData buttonDelegate:(nullable id )buttonDelegate; - -// Sets up with two buttons. -- (void)setupWithTwoButtons; - -// For subclassing, just returns the button. -- (nonnull id)createButton; - -// Change the alignment of the button -- (void)alignLeft; -- (void)alignCenter; -- (void)alignRight; -- (void)alignFill;//default behavior - -// Show/hide left and right primary buttons. This does not impact the vertical space of the view. -- (void)hidePrimaryLeftButton; -- (void)hidePrimaryRightButton; -- (void)showBothPrimaryButtons; -- (void)hideBothPrimaryButtons; - -- (void)removeSubviews; - -@end diff --git a/MVMCoreUI/Molecules/PrimaryButtonView.m b/MVMCoreUI/Molecules/PrimaryButtonView.m deleted file mode 100644 index a479efab..00000000 --- a/MVMCoreUI/Molecules/PrimaryButtonView.m +++ /dev/null @@ -1,350 +0,0 @@ -// -// PrimaryButtonView.m -// myverizon -// -// Created by Scott Pfeil on 12/11/15. -// Copyright © 2015 Verizon Wireless. All rights reserved. -// - -#import "PrimaryButtonView.h" -#import -#import -#import -#import "MVMCoreUICommonViewsUtility.h" -#import "MVMCoreUIConstants.h" -#import "UIColor+MFConvenience.h" - -@interface PrimaryButtonView () - -@property (weak, nonatomic) UIView *twoButtonView; -@property (weak, nonatomic) NSLayoutConstraint *alignCenterPin; -@property (weak, nonatomic) NSLayoutConstraint *alignCenterLeftPin; -@property (weak, nonatomic) NSLayoutConstraint *alignCenterRightPin; -@property (weak, nonatomic) NSLayoutConstraint *height; - -@property (nonatomic, strong) NSArray *horizontalConstraints; - -@end - -@implementation PrimaryButtonView - -- (void)updateView:(CGFloat)size { - [super updateView:size]; - [MVMCoreDispatchUtility performBlockOnMainThread:^{ - [self.primaryButton updateView:size]; - [self.secondaryButton updateView:size]; - }]; -} - -- (void)setWithJSON:(NSDictionary *)json delegate:(NSObject *)delegate additionalData:(nullable NSDictionary *)additionalData { - [super setWithJSON:json delegate:delegate additionalData:additionalData]; - NSString *backgroundColorString = [json string:@"backgroundColor"]; - if (backgroundColorString) { - self.backgroundColor = [UIColor mfGetColorForHex:backgroundColorString]; - } - NSDictionary *primaryButtonMap = [json dict:@"primaryButton"]; - NSDictionary *secondaryButtonMap = [json dict:@"secondaryButton"]; - [self setupUIWithPrimaryButtonMap:primaryButtonMap secondaryButtonMap:secondaryButtonMap]; - [self.primaryButton setAsStandardCustom]; - [self.secondaryButton setAsSecondaryCustom]; - [self.primaryButton setWithJSON:primaryButtonMap delegate:delegate additionalData:additionalData]; - [self.secondaryButton setWithJSON:secondaryButtonMap delegate:delegate additionalData:additionalData]; -} - -#pragma mark - Inits - -- (instancetype)init { - if (self = [super init]) { - self.backgroundColor = [UIColor clearColor]; - self.translatesAutoresizingMaskIntoConstraints = NO; - [self setupWithSingleButton]; - } - return self; -} - -- (instancetype)initWithCoder:(NSCoder *)aDecoder { - if (self = [super initWithCoder:aDecoder]) { - self.backgroundColor = [UIColor clearColor]; - self.translatesAutoresizingMaskIntoConstraints = NO; - [self setupWithSingleButton]; - } - return self; -} - -- (instancetype)initWithFrame:(CGRect)frame { - if (self = [super initWithFrame:frame]) { - self.backgroundColor = [UIColor clearColor]; - self.translatesAutoresizingMaskIntoConstraints = NO; - [self setupWithSingleButton]; - } - return self; -} - -- (nonnull instancetype)initButtonSmall:(BOOL)small enabled:(BOOL)enabled { - if (self = [self init]) { - [self.primaryButton setAsSmallButton:small]; - [self.primaryButton setEnabled:enabled]; - } - return self; -} - -- (nonnull instancetype)initWithTwoButtons { - if (self = [self init]) { - [self setupWithTwoButtons]; - } - return self; -} - -#pragma mark - Legacy Setup - -- (nonnull instancetype)initButtonSmall:(BOOL)small buttonMap:(nullable NSDictionary *)buttonMap actionDelegate:(nullable NSObject *)actionDelegate additionalData:(nullable NSDictionary *)additionalData buttonDelegate:(nullable id )buttonDelegate { - if (self = [self init]) { - [self setupWithButtonMap:buttonMap actionDelegate:actionDelegate additionalData:additionalData buttonDelegate:buttonDelegate]; - [self.primaryButton setAsSmallButton:small]; - [self.secondaryButton setAsSmallButton:small]; - } - return self; -} - -- (nonnull instancetype)initWithPrimaryButtonMap:(nullable NSDictionary *)primaryButtonMap secondaryButtonMap:(nullable NSDictionary *)secondaryButtonMap actionDelegate:(nullable NSObject *)actionDelegate additionalData:(nullable NSDictionary *)additionalData buttonDelegate:(nullable id )buttonDelegate { - if (self = [self init]) { - [self setupWithPrimaryButtonMap:primaryButtonMap secondaryButtonMap:secondaryButtonMap actionDelegate:actionDelegate additionalData:additionalData buttonDelegate:buttonDelegate]; - } - return self; -} - -- (void)setupWithButtonMap:(nullable NSDictionary *)buttonMap actionDelegate:(nullable NSObject *)actionDelegate additionalData:(nullable NSDictionary *)additionalData buttonDelegate:(nullable id )buttonDelegate { - NSDictionary *secondaryButtonMap = [buttonMap dict:KeySecondaryButton]; - NSDictionary *primaryButtonMap = [buttonMap dict:KeyPrimaryButton]; - [self setupWithPrimaryButtonMap:primaryButtonMap secondaryButtonMap:secondaryButtonMap actionDelegate:actionDelegate additionalData:additionalData buttonDelegate:buttonDelegate]; -} - -- (void)setupWithPrimaryButtonMap:(nullable NSDictionary *)primaryButtonMap secondaryButtonMap:(nullable NSDictionary *)secondaryButtonMap actionDelegate:(nullable NSObject *)actionDelegate additionalData:(nullable NSDictionary *)additionalData buttonDelegate:(nullable id )buttonDelegate { - [self setupUIWithPrimaryButtonMap:primaryButtonMap secondaryButtonMap:secondaryButtonMap]; - if (self.primaryButton && self.secondaryButton) { - [self.primaryButton setWithActionMap:primaryButtonMap actionDelegate:actionDelegate additionalData:additionalData buttonDelegate:buttonDelegate]; - [self.secondaryButton setWithActionMap:secondaryButtonMap actionDelegate:actionDelegate additionalData:additionalData buttonDelegate:buttonDelegate]; - } else if (self.primaryButton) { - [self.primaryButton setWithActionMap:primaryButtonMap actionDelegate:actionDelegate additionalData:additionalData buttonDelegate:buttonDelegate]; - self.primaryButton.bordered = NO; - } else { - [self.primaryButton setWithActionMap:secondaryButtonMap actionDelegate:actionDelegate additionalData:additionalData buttonDelegate:buttonDelegate]; - self.primaryButton.bordered = YES; - } -} - -#pragma mark - Setup - -- (void)setupUIWithPrimaryButtonMap:(nullable NSDictionary *)primaryButtonMap secondaryButtonMap:(nullable NSDictionary *)secondaryButtonMap { - if (primaryButtonMap && secondaryButtonMap) { - self.height.active = NO; - - // Setup with two buttons - if (!self.primaryButton || !self.secondaryButton) { - [self removeSubviews]; - self.twoButtonView = nil; - [self setupWithTwoButtons]; - } - } else if (primaryButtonMap || secondaryButtonMap) { - self.height.active = NO; - - // Setup with one button. - if (!self.primaryButton || self.secondaryButton) { - [self removeSubviews]; - self.primaryButton = nil; - self.secondaryButton = nil; - [self setupWithSingleButton]; - } - } else { - [self removeSubviews]; - if (!self.height) { - NSLayoutConstraint *height = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0]; - height.active = YES; - self.height = height; - } - } -} - -- (id)createButton { - return [PrimaryButton primaryButton:NO]; -} - -- (void)setupWithTwoButtons { - if (self.primaryButton) { - [self.primaryButton removeFromSuperview]; - self.primaryButton = nil; - } - - if (!self.twoButtonView) { - self.backgroundColor = [UIColor clearColor]; - self.translatesAutoresizingMaskIntoConstraints = NO; - - UIView *buttonView = [MVMCoreUICommonViewsUtility commonView]; - - PrimaryButton *leftButton = [PrimaryButton primaryButton]; - leftButton.bordered = YES; - leftButton.translatesAutoresizingMaskIntoConstraints = NO; - [buttonView addSubview:leftButton]; - self.secondaryButton = leftButton; - - PrimaryButton *rightButton = [PrimaryButton primaryButton]; - rightButton.translatesAutoresizingMaskIntoConstraints = NO; - [buttonView addSubview:rightButton]; - self.primaryButton = rightButton; - - [rightButton.widthAnchor constraintEqualToAnchor:leftButton.widthAnchor multiplier:1].active = YES; - - [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[leftButton]-0-|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:NSDictionaryOfVariableBindings(leftButton)]]; - [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[rightButton]-0-|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:NSDictionaryOfVariableBindings(rightButton)]]; - self.horizontalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[leftButton]-10-[rightButton]-0-|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:NSDictionaryOfVariableBindings(leftButton,rightButton)]; - [NSLayoutConstraint activateConstraints:self.horizontalConstraints]; - [self addSubview:buttonView]; - - [self setupAlignmentsWithView:buttonView]; - - self.twoButtonView = buttonView; - - [self alignCenter]; - } -} - -- (void)setupWithSingleButton { - - if (!self.primaryButton) { - self.backgroundColor = [UIColor clearColor]; - self.translatesAutoresizingMaskIntoConstraints = NO; - - PrimaryButton *button = [self createButton]; - button.translatesAutoresizingMaskIntoConstraints = NO; - [self addSubview:button]; - self.primaryButton = button; - - [self setupAlignmentsWithView:button]; - - [self alignCenter]; - } -} - -- (void)setupAlignmentsWithView:(UIView *)view { - // Align left and right constants. - NSLayoutConstraint *leftPin = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]; - self.leftPin = leftPin; - leftPin.active = YES; - - NSLayoutConstraint *topPin = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0]; - self.topPin = topPin; - topPin.active = YES; - - NSLayoutConstraint *bottomPin = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; - self.bottomPin = bottomPin; - bottomPin.active = YES; - - NSLayoutConstraint *rightPin = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; - self.rightPin = rightPin; - rightPin.active = YES; - - // Center alignments - NSLayoutConstraint *alignCenter = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]; - self.alignCenterPin = alignCenter; - alignCenter.active = YES; - - NSLayoutConstraint *centerLeftPin = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]; - self.alignCenterLeftPin = centerLeftPin; - centerLeftPin.active = YES; - - NSLayoutConstraint *centerRightPin = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; - self.alignCenterRightPin = centerRightPin; - centerRightPin.active = YES; -} - -#pragma mark - Configuring - -- (void)alignLeft { - self.alignCenterPin.active = NO; - self.alignCenterLeftPin.active = NO; - self.alignCenterRightPin.active = YES; - self.leftPin.active = YES; - self.rightPin.active = NO; -} - -- (void)alignCenter { - self.alignCenterPin.active = YES; - self.alignCenterLeftPin.active = YES; - self.alignCenterRightPin.active = YES; - self.leftPin.active = NO; - self.rightPin.active = NO; -} - -- (void)alignFill { - self.alignCenterPin.active = NO; - self.alignCenterLeftPin.active = NO; - self.alignCenterRightPin.active = NO; - self.leftPin.active = YES; - self.rightPin.active = YES; -} - -- (void)alignRight { - self.alignCenterPin.active = NO; - self.alignCenterLeftPin.active = YES; - self.alignCenterRightPin.active = NO; - self.leftPin.active = NO; - self.rightPin.active = YES; -} - -- (void)setLeftPinConstant:(CGFloat)constant { - [super setLeftPinConstant:constant]; - self.alignCenterLeftPin.constant = constant; -} - -- (void)setRightPinConstant:(CGFloat)constant { - [super setRightPinConstant:constant]; - self.alignCenterRightPin.constant = constant; -} - -- (void)resetConstraints { - [super resetConstraints]; - self.primaryButton.enabled = NO; -} - -- (void)hidePrimaryLeftButton { - if (!self.secondaryButton.hidden) { - self.secondaryButton.hidden = YES; - PrimaryButton *rightButton = self.primaryButton; - [NSLayoutConstraint deactivateConstraints:self.horizontalConstraints]; - self.horizontalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[rightButton]-0-|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:NSDictionaryOfVariableBindings(rightButton)]; - [NSLayoutConstraint activateConstraints:self.horizontalConstraints]; - } -} - -- (void)hidePrimaryRightButton { - if (!self.primaryButton.hidden) { - self.primaryButton.hidden = YES; - PrimaryButton *leftButton = self.secondaryButton; - [NSLayoutConstraint deactivateConstraints:self.horizontalConstraints]; - self.horizontalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[leftButton]-0-|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:NSDictionaryOfVariableBindings(leftButton)]; - [NSLayoutConstraint activateConstraints:self.horizontalConstraints]; - } -} - -- (void)showBothPrimaryButtons { - self.primaryButton.hidden = NO; - self.secondaryButton.hidden = NO; - PrimaryButton *rightButton = self.primaryButton; - PrimaryButton *leftButton = self.secondaryButton; - [NSLayoutConstraint deactivateConstraints:self.horizontalConstraints]; - self.horizontalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[leftButton]-10-[rightButton]-0-|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:NSDictionaryOfVariableBindings(leftButton,rightButton)]; - [NSLayoutConstraint activateConstraints:self.horizontalConstraints]; -} - -- (void)hideBothPrimaryButtons { - self.primaryButton.hidden = YES; - self.secondaryButton.hidden = YES; -} - -- (void)removeSubviews { - for (UIView *view in self.subviews) { - [view removeFromSuperview]; - } -} - -@end