93 lines
3.4 KiB
Objective-C
93 lines
3.4 KiB
Objective-C
//
|
|
// TopLabelsAndBottomButtonsViewController.m
|
|
// myverizon
|
|
//
|
|
// Created by Scott Pfeil on 1/26/16.
|
|
// Copyright © 2016 Verizon Wireless. All rights reserved.
|
|
//
|
|
|
|
#import "TopLabelsAndBottomButtonsViewController.h"
|
|
#import <MVMCoreUI/PrimaryButtonView.h>
|
|
#import <MVMCoreUI/MFSizeObject.h>
|
|
#import <MVMCoreUI/MVMCoreUICommonViewsUtility.h>
|
|
#import <MVMCoreUI/UIColor+MFConvenience.h>
|
|
#import <MVMCoreUI/NSLayoutConstraint+MFConvenience.h>
|
|
#import <MVMCoreUI/MVMCoreUIConstants.h>
|
|
#import <MVMCoreUI/MFStyler.h>
|
|
#import <MVMCoreUI/MVMCoreUIUtility.h>
|
|
#import <MVMCoreUI/TopLabelsView.h>
|
|
#import <MVMCore/NSDictionary+MFConvenience.h>
|
|
#import <MVMCore/MVMCoreLoadObject.h>
|
|
#import <MVMCore/MVMCoreJSONConstants.h>
|
|
#import <MVMCore/MVMCoreConstants.h>
|
|
|
|
@import MVMAnimationFramework;
|
|
|
|
@interface TopLabelsAndBottomButtonsViewController ()
|
|
|
|
@end
|
|
|
|
@implementation TopLabelsAndBottomButtonsViewController
|
|
|
|
- (void)initialLoad {
|
|
[super initialLoad];
|
|
self.rebuildUIOnSizeChange = YES;
|
|
}
|
|
|
|
- (void)updateViews {
|
|
if ([self screenSizeChanged] && self.rebuildUIOnSizeChange) {
|
|
|
|
// If the screen size changed.... just rebuild everything.... this will cover all sizes and help for ipad slide over.
|
|
[self newDataBuildScreen];
|
|
}
|
|
[super updateViews];
|
|
}
|
|
|
|
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object {
|
|
return [super spaceAroundUIObject:object size:[MVMCoreUIUtility getWidth]];
|
|
}
|
|
|
|
- (UIEdgeInsets)spaceAroundUIObject:(id)object size:(CGFloat)size {
|
|
return [self spaceAroundUIObject:object];
|
|
}
|
|
|
|
- (UIEdgeInsets)paddingForTopLabels {
|
|
return UIEdgeInsetsMake(PaddingFive, [MFStyler defaultHorizontalPaddingForApplicationWidth], PaddingDefaultVerticalSpacing, [MFStyler defaultHorizontalPaddingForApplicationWidth]);
|
|
}
|
|
|
|
- (UIEdgeInsets)paddingForBottomButtons {
|
|
// Smaller space for smaller devices. Also, top is 0 by default when in scroll.
|
|
CGFloat verticalSpacing = [[MFSizeObject sizeObjectWithStandardSize:PaddingDefaultVerticalSpacing smalliPhoneSize:PaddingDefault] getValueBasedOnScreenSize];
|
|
return UIEdgeInsetsMake(([self bottomViewOutsideOfScroll] ? verticalSpacing : 0), PaddingDefaultHorizontalSpacing, verticalSpacing, PaddingDefaultHorizontalSpacing);
|
|
}
|
|
|
|
- (void)updateTopLabelsPadding:(CGFloat)size {
|
|
if (self.topLabelsView) {
|
|
UIEdgeInsets paddingForTopLabels = [self paddingForTopLabels];
|
|
self.topLabelsView.topLabelConstraint.constant = paddingForTopLabels.top;
|
|
self.topLabelsView.bottomLabelConstraint.constant = paddingForTopLabels.bottom;
|
|
[self.topLabelsView setLeftConstant:paddingForTopLabels.left];
|
|
[self.topLabelsView setRightConstant:paddingForTopLabels.right];
|
|
}
|
|
}
|
|
|
|
- (void)updateBottomButtonsPadding:(CGFloat)size {
|
|
if (!self.customBottomView) {
|
|
PrimaryButtonView *buttonView = (PrimaryButtonView *)self.bottomView;
|
|
if (self.secondaryButton || self.primaryButton) {
|
|
UIEdgeInsets paddingForBottomButtons = [self paddingForBottomButtons];
|
|
buttonView.leftPin.constant = paddingForBottomButtons.left;
|
|
buttonView.rightPin.constant = paddingForBottomButtons.right;
|
|
buttonView.topPin.constant = paddingForBottomButtons.top;
|
|
buttonView.bottomPin.constant = paddingForBottomButtons.bottom;
|
|
} else {
|
|
buttonView.topPin.constant = 0;
|
|
buttonView.bottomPin.constant = 0;
|
|
buttonView.leftPin.constant = 0;
|
|
buttonView.rightPin.constant = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
@end
|