strip some base classes to separate ou legacy logic
This commit is contained in:
parent
0e3f775210
commit
2c539b695d
@ -17,6 +17,10 @@
|
||||
D22D1F1F220343560077CEC0 /* MVMCoreUICheckMarkView.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F1D220343560077CEC0 /* MVMCoreUICheckMarkView.m */; };
|
||||
D22D1F46220496A30077CEC0 /* MVMCoreUISwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = D22D1F44220496A30077CEC0 /* MVMCoreUISwitch.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D22D1F47220496A30077CEC0 /* MVMCoreUISwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */; };
|
||||
D22D1F562204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D22D1F572204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */; };
|
||||
D22D1F5B2204D2C00077CEC0 /* MVMCoreUIThreeLayerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D22D1F592204D2C00077CEC0 /* MVMCoreUIThreeLayerViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D22D1F5C2204D2C00077CEC0 /* MVMCoreUIThreeLayerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F5A2204D2C00077CEC0 /* MVMCoreUIThreeLayerViewController.m */; };
|
||||
D28B4F8A21FF967C00712C7A /* MVMCoreUIObject.h in Headers */ = {isa = PBXBuildFile; fileRef = D28B4F8821FF967C00712C7A /* MVMCoreUIObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D28B4F8B21FF967C00712C7A /* MVMCoreUIObject.m in Sources */ = {isa = PBXBuildFile; fileRef = D28B4F8921FF967C00712C7A /* MVMCoreUIObject.m */; };
|
||||
D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */; };
|
||||
@ -164,6 +168,10 @@
|
||||
D22D1F1D220343560077CEC0 /* MVMCoreUICheckMarkView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUICheckMarkView.m; sourceTree = "<group>"; };
|
||||
D22D1F44220496A30077CEC0 /* MVMCoreUISwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreUISwitch.h; sourceTree = "<group>"; };
|
||||
D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUISwitch.m; sourceTree = "<group>"; };
|
||||
D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIStackableViewController.h; sourceTree = "<group>"; };
|
||||
D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIStackableViewController.m; sourceTree = "<group>"; };
|
||||
D22D1F592204D2C00077CEC0 /* MVMCoreUIThreeLayerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIThreeLayerViewController.h; sourceTree = "<group>"; };
|
||||
D22D1F5A2204D2C00077CEC0 /* MVMCoreUIThreeLayerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIThreeLayerViewController.m; sourceTree = "<group>"; };
|
||||
D28B4F8821FF967C00712C7A /* MVMCoreUIObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIObject.h; sourceTree = "<group>"; };
|
||||
D28B4F8921FF967C00712C7A /* MVMCoreUIObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIObject.m; sourceTree = "<group>"; };
|
||||
D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsView.m; sourceTree = "<group>"; };
|
||||
@ -317,6 +325,19 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
D22D1F582204D2590077CEC0 /* LegacyControllers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D29DF29321E7ADB8003B2FB9 /* StackableViewController.h */,
|
||||
D29DF28E21E7ADB8003B2FB9 /* StackableViewController.m */,
|
||||
D29770F021F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.h */,
|
||||
D29770F121F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.m */,
|
||||
D29770EF21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.h */,
|
||||
D29770EE21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m */,
|
||||
);
|
||||
path = LegacyControllers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D29DF0C221E404D4003B2FB9 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -343,6 +364,7 @@
|
||||
D29DF13321E68604003B2FB9 /* Styles */,
|
||||
D29DF11021E6805F003B2FB9 /* Categories */,
|
||||
D29DF11921E68467003B2FB9 /* Containers */,
|
||||
D22D1F582204D2590077CEC0 /* LegacyControllers */,
|
||||
D29DF10F21E67A7D003B2FB9 /* BaseControllers */,
|
||||
D29DF11E21E6851E003B2FB9 /* TopAlert */,
|
||||
D29DF10D21E67A70003B2FB9 /* Atoms */,
|
||||
@ -406,14 +428,12 @@
|
||||
D29DF28D21E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m */,
|
||||
D29DF29221E7ADB8003B2FB9 /* MFProgrammaticTableViewController.h */,
|
||||
D29DF29421E7ADB8003B2FB9 /* MFProgrammaticTableViewController.m */,
|
||||
D29DF29321E7ADB8003B2FB9 /* StackableViewController.h */,
|
||||
D29DF28E21E7ADB8003B2FB9 /* StackableViewController.m */,
|
||||
D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */,
|
||||
D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */,
|
||||
D29DF2CC21E7C104003B2FB9 /* MFLoadingViewController.h */,
|
||||
D29DF2CD21E7C104003B2FB9 /* MFLoadingViewController.m */,
|
||||
D29770F021F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.h */,
|
||||
D29770F121F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.m */,
|
||||
D29770EF21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.h */,
|
||||
D29770EE21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m */,
|
||||
D22D1F592204D2C00077CEC0 /* MVMCoreUIThreeLayerViewController.h */,
|
||||
D22D1F5A2204D2C00077CEC0 /* MVMCoreUIThreeLayerViewController.m */,
|
||||
);
|
||||
path = BaseControllers;
|
||||
sourceTree = "<group>";
|
||||
@ -690,8 +710,10 @@
|
||||
D29DF2BC21E7BEA4003B2FB9 /* TopTabbar.h in Headers */,
|
||||
D29DF25921E6A22D003B2FB9 /* MFButtonProtocol.h in Headers */,
|
||||
D22D1F46220496A30077CEC0 /* MVMCoreUISwitch.h in Headers */,
|
||||
D22D1F5B2204D2C00077CEC0 /* MVMCoreUIThreeLayerViewController.h in Headers */,
|
||||
D22D1F1E220343560077CEC0 /* MVMCoreUICheckMarkView.h in Headers */,
|
||||
D29DF28421E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.h in Headers */,
|
||||
D22D1F562204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h in Headers */,
|
||||
D29DF2CE21E7C104003B2FB9 /* MFLoadingViewController.h in Headers */,
|
||||
D29DF12A21E6851E003B2FB9 /* MVMCoreUITopAlertView.h in Headers */,
|
||||
D29DF27521E79E81003B2FB9 /* MVMCoreUILoggingHandler.h in Headers */,
|
||||
@ -833,6 +855,7 @@
|
||||
D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */,
|
||||
D29DF12E21E6851E003B2FB9 /* MVMCoreUITopAlertView.m in Sources */,
|
||||
D29DF2CF21E7C104003B2FB9 /* MFLoadingViewController.m in Sources */,
|
||||
D22D1F572204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m in Sources */,
|
||||
01DF567021FA5AB300CC099B /* MVMCoreUITextFieldListFormViewController.swift in Sources */,
|
||||
D29DF27621E79E81003B2FB9 /* MVMCoreUILoggingHandler.m in Sources */,
|
||||
D29DF24D21E6A177003B2FB9 /* MFTextField.m in Sources */,
|
||||
@ -843,6 +866,7 @@
|
||||
D29DF13021E6851E003B2FB9 /* MVMCoreUITopAlertShortView.m in Sources */,
|
||||
D28B4F8B21FF967C00712C7A /* MVMCoreUIObject.m in Sources */,
|
||||
D29DF26D21E6AA0B003B2FB9 /* FLAnimatedImageView.m in Sources */,
|
||||
D22D1F5C2204D2C00077CEC0 /* MVMCoreUIThreeLayerViewController.m in Sources */,
|
||||
D29DF2EF21ECEAE1003B2FB9 /* MFFonts.m in Sources */,
|
||||
D29DF2AE21E7B3A4003B2FB9 /* MFTextView.m in Sources */,
|
||||
D29DF18121E69E50003B2FB9 /* MFView.m in Sources */,
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
//
|
||||
// StackableViewController.h
|
||||
// myverizon
|
||||
// MVMCoreUIStackableViewController.h
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 3/26/14.
|
||||
// Copyright (c) 2014 Verizon Wireless. All rights reserved.
|
||||
// Created by Scott Pfeil on 2/1/19.
|
||||
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
// This view controller is here to enable faster development of standard form screens. Put all ui objects that you want to be displayed in a top down order in an array and then call the generateFormWithUIArray. Any type can go in it.
|
||||
|
||||
#import <MVMCoreUI/ProgrammaticScrollViewController.h>
|
||||
|
||||
@interface StackableViewController : ProgrammaticScrollViewController
|
||||
@interface MVMCoreUIStackableViewController : ProgrammaticScrollViewController
|
||||
|
||||
// An array of ui elements that will be spaced out on the screen top to bottom from index 0 to formUIArray.count.
|
||||
@property (nullable, strong, nonatomic) NSArray *formUIArray;
|
||||
@ -17,12 +16,9 @@
|
||||
// Generates the form view with the passed in form ui array.
|
||||
- (void)generateFormViewWithUIArray:(nullable NSArray <UIView *>*)formUIArray;
|
||||
- (void)generateFormView:(nullable UIView *)view withUIArrayForConstrainingViews:(nullable NSArray <UIView *>*)formUIArray;
|
||||
|
||||
// Returns the spacing that should surround the passed in item. Subclass this to change spacing.
|
||||
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object;
|
||||
|
||||
// When using constraining views in the form array, resets the space that should surround each element.
|
||||
- (void)resetSpaceForFormArrayWithConstrainingViews;
|
||||
// Returns the spacing that should surround the passed in item. Subclass this to change spacing.
|
||||
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object size:(CGFloat)size;
|
||||
|
||||
// Removes all the subviews in the form ui array.
|
||||
- (void)removeUIViews;
|
||||
@ -31,8 +27,8 @@
|
||||
+ (void)removeUIViews:(nullable NSArray <UIView *>*)views;
|
||||
|
||||
// Returns the standard space around ui objects.
|
||||
+ (UIEdgeInsets)standardSpaceAroundUIObject;
|
||||
|
||||
+ (UIEdgeInsets)standardSpaceAroundUIObjectForSize:(CGFloat)size;
|
||||
|
||||
// Consolidates generateFormViewWithUIArray and spaceArroundUIObject into one class object so other view controllers can take advantage of these functions.
|
||||
+ (void)populateView:(nonnull UIView *)view withUIArray:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock;
|
||||
+ (void)populateViewHorizontally:(nonnull UIView *)view withUIArray:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock;
|
||||
@ -1,20 +1,30 @@
|
||||
//
|
||||
// StackableViewController.m
|
||||
// myverizon
|
||||
// MVMCoreUIMVMCoreUIStackableViewController.m
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 3/26/14.
|
||||
// Copyright (c) 2014 Verizon Wireless. All rights reserved.
|
||||
// Created by Scott Pfeil on 2/1/19.
|
||||
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
#import "StackableViewController.h"
|
||||
#import "MVMCoreUIStackableViewController.h"
|
||||
#import "MFStyler.h"
|
||||
#import "ViewConstrainingView.h"
|
||||
|
||||
@interface StackableViewController ()
|
||||
#import "MVMCoreUIUtility.h"
|
||||
@interface MVMCoreUIStackableViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation StackableViewController
|
||||
@implementation MVMCoreUIStackableViewController
|
||||
|
||||
- (void)updateViews {
|
||||
[super updateViews];
|
||||
for (UIView *view in self.formUIArray) {
|
||||
CGFloat size = CGRectGetWidth(self.view.bounds);
|
||||
ViewConstrainingView *constrainingView = (ViewConstrainingView *)view.superview;
|
||||
[constrainingView setPinConstantsWithInsets:[self spaceAroundUIObject:view size:size]];
|
||||
[constrainingView updateView:size];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)newDataBuildScreen {
|
||||
[super newDataBuildScreen];
|
||||
@ -24,33 +34,31 @@
|
||||
}
|
||||
|
||||
- (void)generateFormViewWithUIArray:(nullable NSArray <UIView *>*)formUIArray {
|
||||
|
||||
self.formUIArray = formUIArray;
|
||||
[StackableViewController populateView:self.contentView withUIArray:formUIArray withSpacingBlock:^UIEdgeInsets(id _Nullable object) {
|
||||
return [self spaceAroundUIObject:object];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)generateFormView:(nullable UIView *)view withUIArrayForConstrainingViews:(nullable NSArray <UIView *>*)formUIArray {
|
||||
self.formUIArray = formUIArray;
|
||||
[StackableViewController populateView:view withUIArrayForConstrainingViews:formUIArray withSpacingBlock:^UIEdgeInsets(id _Nullable object) {
|
||||
return [self spaceAroundUIObject:object];
|
||||
[MVMCoreUIStackableViewController populateView:self.contentView withUIArray:formUIArray withSpacingBlock:^UIEdgeInsets(id _Nullable object) {
|
||||
return [self spaceAroundUIObject:object size:[MVMCoreUIUtility getWidth]];
|
||||
}];
|
||||
}
|
||||
|
||||
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object {
|
||||
|
||||
UIEdgeInsets insets = [StackableViewController standardSpaceAroundUIObject];
|
||||
- (void)generateFormView:(nullable UIView *)view withUIArrayForConstrainingViews:(nullable NSArray <UIView *>*)formUIArray {
|
||||
self.formUIArray = formUIArray;
|
||||
[MVMCoreUIStackableViewController populateView:view withUIArrayForConstrainingViews:formUIArray withSpacingBlock:^UIEdgeInsets(id _Nullable object) {
|
||||
return [self spaceAroundUIObject:object size:[MVMCoreUIUtility getWidth]];
|
||||
}];
|
||||
}
|
||||
|
||||
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object size:(CGFloat)size {
|
||||
UIEdgeInsets insets = [MVMCoreUIStackableViewController standardSpaceAroundUIObjectForSize:size];
|
||||
if (object == [self.formUIArray lastObject]) {
|
||||
|
||||
// The last object should have space from the bottom
|
||||
insets.bottom = [MFStyler defaultVerticalPaddingForApplicationWidth];
|
||||
insets.bottom = [MFStyler defaultVerticalPaddingForSize:size];
|
||||
}
|
||||
return insets;
|
||||
}
|
||||
|
||||
- (void)removeUIViews {
|
||||
[StackableViewController removeUIViews:self.formUIArray];
|
||||
[MVMCoreUIStackableViewController removeUIViews:self.formUIArray];
|
||||
}
|
||||
|
||||
+ (void)removeUIViews:(nullable NSArray <UIView *>*)views {
|
||||
@ -61,44 +69,34 @@
|
||||
}
|
||||
|
||||
+ (void)populateView:(nonnull UIView *)view withUIArray:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock {
|
||||
|
||||
if ([formUIArray count] > 0) {
|
||||
|
||||
for (UIView *subview in formUIArray) {
|
||||
[view addSubview:subview];
|
||||
}
|
||||
|
||||
[StackableViewController autoLayoutView:view withUIArray:formUIArray withSpacingBlock:spacingBlock];
|
||||
[MVMCoreUIStackableViewController autoLayoutView:view withUIArray:formUIArray withSpacingBlock:spacingBlock];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)populateViewHorizontally:(nonnull UIView *)view withUIArray:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock {
|
||||
|
||||
if ([formUIArray count] > 0) {
|
||||
|
||||
for (UIView *subview in formUIArray) {
|
||||
[view addSubview:subview];
|
||||
}
|
||||
|
||||
[StackableViewController autoLayoutViewHorizontally:view withUIArray:formUIArray withSpacingBlock:spacingBlock];
|
||||
[MVMCoreUIStackableViewController autoLayoutViewHorizontally:view withUIArray:formUIArray withSpacingBlock:spacingBlock];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+ (void)populateView:(nonnull UIView *)view withUIArrayForConstrainingViews:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock {
|
||||
|
||||
if ([formUIArray count] > 0) {
|
||||
|
||||
for (UIView *subview in formUIArray) {
|
||||
ViewConstrainingView *constrainingView = [ViewConstrainingView viewConstrainingView:subview];
|
||||
[view addSubview:constrainingView];
|
||||
}
|
||||
|
||||
[StackableViewController autoLayoutViewWithConstrainingViewsWithUIArray:formUIArray withSpacingBlock:spacingBlock];
|
||||
[MVMCoreUIStackableViewController autoLayoutViewWithConstrainingViewsWithUIArray:formUIArray withSpacingBlock:spacingBlock];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)autoLayoutView:(nonnull UIView *)view withUIArray:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock {
|
||||
|
||||
if ([formUIArray count] > 0) {
|
||||
|
||||
// Adds the first object to the view and pins it to the top of the content view.
|
||||
@ -127,7 +125,6 @@
|
||||
}
|
||||
|
||||
+ (void)autoLayoutViewHorizontally:(nonnull UIView *)view withUIArray:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock {
|
||||
|
||||
if ([formUIArray count] > 0) {
|
||||
|
||||
// Adds the first object to the view and pins it to the top and left of the content view.
|
||||
@ -154,7 +151,7 @@
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[previousUIObject]-right-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:@{@"right":@(spaceAroundObjectPrevious.right)} views:NSDictionaryOfVariableBindings(previousUIObject)]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+ (void)autoLayoutViewWithConstrainingViewsWithUIArray:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock {
|
||||
if ([formUIArray count] > 0) {
|
||||
|
||||
@ -188,16 +185,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)resetSpaceForFormArrayWithConstrainingViews {
|
||||
for (UIView *view in self.formUIArray) {
|
||||
ViewConstrainingView *constrainingView = (ViewConstrainingView *)view.superview;
|
||||
[constrainingView setPinConstantsWithInsets:[self spaceAroundUIObject:view]];
|
||||
}
|
||||
}
|
||||
|
||||
+ (UIEdgeInsets)standardSpaceAroundUIObject {
|
||||
CGFloat horizontal = [MFStyler defaultHorizontalPaddingForApplicationWidth];
|
||||
CGFloat vertical = [MFStyler defaultVerticalPaddingForApplicationWidth];
|
||||
+ (UIEdgeInsets)standardSpaceAroundUIObjectForSize:(CGFloat)size {
|
||||
CGFloat horizontal = [MFStyler defaultHorizontalPaddingForSize:size];
|
||||
CGFloat vertical = [MFStyler defaultVerticalPaddingForSize:size];
|
||||
return UIEdgeInsetsMake(vertical, horizontal, 0, horizontal);
|
||||
}
|
||||
|
||||
@ -1,20 +1,16 @@
|
||||
//
|
||||
// TopLabelsAndBottomButtonsViewController.h
|
||||
// myverizon
|
||||
// MVMCoreUIThreeLayerViewController.h
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/26/16.
|
||||
// Copyright © 2016 Verizon Wireless. All rights reserved.
|
||||
// Created by Scott Pfeil on 2/1/19.
|
||||
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
// Has top labels docked on top, buttons docked on bottom, and anything you'd like in between when subclassed.
|
||||
|
||||
#import <MVMCoreUI/StackableViewController.h>
|
||||
#import <MVMCoreUI/ViewConstrainingView.h>
|
||||
#import <MVMCoreUI/TopLabelsView.h>
|
||||
|
||||
@class LabelView;
|
||||
#import <MVMCoreUI/MVMCoreUIStackableViewController.h>
|
||||
@class TopLabelsView;
|
||||
@class PrimaryButton;
|
||||
|
||||
@interface TopLabelsAndBottomButtonsViewController : StackableViewController
|
||||
@interface MVMCoreUIThreeLayerViewController : MVMCoreUIStackableViewController
|
||||
|
||||
@property (nullable, weak, nonatomic) TopLabelsView *topLabelsView;
|
||||
@property (nullable, weak, nonatomic) PrimaryButton *primaryButton;
|
||||
@ -24,6 +20,7 @@
|
||||
@property (nullable, weak, nonatomic) UIView *viewInScroll;
|
||||
@property (nullable, weak, nonatomic) UIView *viewOutOfScroll;
|
||||
@property (nullable, strong, nonatomic) UIView *safeAreaView;
|
||||
@property (nonatomic, readonly) BOOL customBottomView;
|
||||
|
||||
// Set to overwrite which view is the top edge and/or bottom edge of the between view. must be added to the ui and constrained before buildViewsBetweenLabelsAndButtons.
|
||||
// Use these to create views that are pinned near the labels or buttons and are separate from any centered content. Add and set in buildInAdditionalViewsBeforeCenteredContent.
|
||||
@ -33,13 +30,11 @@
|
||||
// The constraint connecting the topLabelsView to the content view.
|
||||
@property (nullable, strong, nonatomic) NSLayoutConstraint *topConstraintForTopView;
|
||||
|
||||
// Can override. This is put in because to cover 90% of the screens for initial ipad release, need to rebuild ui (newDataBuildScreen) of size of view change in updateViews. Disable this to handle manually with more finess.
|
||||
@property (nonatomic) BOOL rebuildUIOnSizeChange;
|
||||
|
||||
#pragma mark - Subclass
|
||||
|
||||
// Allow you to add any additional ui before buildViewsBetweenLabelsAndButtons gets called. Can use this to set the topBetweenEdgeView or bottomBetweenEdgeView
|
||||
- (void)buildInAdditionalViewsBeforeCenteredContent;
|
||||
|
||||
// For subclassing. Should return all the views that will be in between labels and buttons. Override standardSpaceAroundUIObject to handle spacing.
|
||||
- (nullable NSArray <UIView *>*)buildViewsBetweenLabelsAndButtons;
|
||||
|
||||
@ -53,8 +48,8 @@
|
||||
- (nullable NSNumber *)spaceBelowBetweenView;
|
||||
|
||||
// Can overwrite the default padding for labels and buttons.
|
||||
- (UIEdgeInsets)paddingForTopLabels;
|
||||
- (UIEdgeInsets)paddingForBottomButtons;
|
||||
- (void)updateTopLabelsPadding:(CGFloat)size;
|
||||
- (void)updateBottomButtonsPadding:(CGFloat)size;
|
||||
|
||||
// default button map will automatically get from response, you can also overide this to have your own button map
|
||||
- (nullable NSDictionary *)secondaryButtonMap;
|
||||
@ -1,32 +1,29 @@
|
||||
//
|
||||
// TopLabelsAndBottomButtonsViewController.m
|
||||
// myverizon
|
||||
// MVMCoreUIThreeLayerViewController.m
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/26/16.
|
||||
// Copyright © 2016 Verizon Wireless. All rights reserved.
|
||||
// Created by Scott Pfeil on 2/1/19.
|
||||
// Copyright © 2019 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 <MVMCore/NSDictionary+MFConvenience.h>
|
||||
#import <MVMCore/MVMCoreLoadObject.h>
|
||||
#import <MVMCore/MVMCoreJSONConstants.h>
|
||||
#import <MVMCore/MVMCoreConstants.h>
|
||||
|
||||
#import "MVMCoreUIThreeLayerViewController.h"
|
||||
#import "ViewConstrainingView.h"
|
||||
#import "MFStyler.h"
|
||||
#import "MFSizeObject.h"
|
||||
#import "TopLabelsView.h"
|
||||
#import "PrimaryButtonView.h"
|
||||
#import "MVMCoreUICommonViewsUtility.h"
|
||||
#import "UIColor+MFConvenience.h"
|
||||
#import "NSLayoutConstraint+MFConvenience.h"
|
||||
#import "MVMCoreUIConstants.h"
|
||||
@import MVMAnimationFramework;
|
||||
|
||||
@interface TopLabelsAndBottomButtonsViewController ()
|
||||
@interface MVMCoreUIThreeLayerViewController ()
|
||||
|
||||
@property (nullable, strong, nonatomic) NSLayoutConstraint *heightConstraint;
|
||||
@property (nullable, weak, nonatomic) UIView *topView;
|
||||
@property (nullable, weak, nonatomic) UIView *bottomView;
|
||||
@property (nonatomic) BOOL customBottemView;
|
||||
@property (nonatomic, readwrite) BOOL customBottomView;
|
||||
@property (nullable, weak, nonatomic) NSArray *middleViews;
|
||||
|
||||
@property (nullable, weak, nonatomic) UIView *betweenView;
|
||||
@ -38,55 +35,46 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation TopLabelsAndBottomButtonsViewController
|
||||
|
||||
- (void)initialLoad {
|
||||
[super initialLoad];
|
||||
self.rebuildUIOnSizeChange = YES;
|
||||
}
|
||||
@implementation MVMCoreUIThreeLayerViewController
|
||||
|
||||
- (void)updateViews {
|
||||
[super updateViews];
|
||||
|
||||
if ([self screenSizeChanged]) {
|
||||
if (self.rebuildUIOnSizeChange) {
|
||||
|
||||
// If the screen size changed.... just rebuild everything.... this will cover all sizes and help for ipad slide over.
|
||||
[self newDataBuildScreen];
|
||||
} else {
|
||||
|
||||
// Update top labels and bottom buttons.
|
||||
CGFloat width = CGRectGetWidth(self.view.bounds);
|
||||
if ([self.topView respondsToSelector:@selector(updateView:)]) {
|
||||
[((UIView <MVMCoreViewProtocol>*)self.topView) updateView:width];
|
||||
}
|
||||
if ([self.bottomView respondsToSelector:@selector(updateView:)]) {
|
||||
[((UIView <MVMCoreViewProtocol>*)self.bottomView) updateView:width];
|
||||
}
|
||||
[self updateTopLabelsBottomButtonsPadding];
|
||||
[self.bottomAccessoryView updateView:width];
|
||||
[self resetSpaceForFormArrayWithConstrainingViews];
|
||||
}
|
||||
// Update top labels and bottom buttons.
|
||||
CGFloat width = CGRectGetWidth(self.view.bounds);
|
||||
if ([self.topView respondsToSelector:@selector(updateView:)]) {
|
||||
[((UIView <MVMCoreViewProtocol>*)self.topView) updateView:width];
|
||||
}
|
||||
if ([self.bottomView respondsToSelector:@selector(updateView:)]) {
|
||||
[((UIView <MVMCoreViewProtocol>*)self.bottomView) updateView:width];
|
||||
}
|
||||
[self updateTopLabelsPadding:width];
|
||||
[self updateBottomButtonsPadding:width];
|
||||
[self.bottomAccessoryView updateView:width];
|
||||
[self.bottomAccessoryView setPinConstantsWithInsets:[self spaceAroundUIObject:self.bottomAccessoryView size:width]];
|
||||
|
||||
}
|
||||
|
||||
- (void)updateTopLabelsPadding:(CGFloat)size {
|
||||
if (self.topLabelsView) {
|
||||
CGFloat horizontalPadding = [MFStyler defaultHorizontalPaddingForSize:size];
|
||||
self.topLabelsView.topLabelConstraint.constant = PaddingFive;
|
||||
self.topLabelsView.bottomLabelConstraint.constant = PaddingFive;
|
||||
[self.topLabelsView setLeftConstant:horizontalPadding];
|
||||
[self.topLabelsView setRightConstant:horizontalPadding];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateTopLabelsBottomButtonsPadding {
|
||||
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];
|
||||
}
|
||||
|
||||
if (!self.customBottemView) {
|
||||
- (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;
|
||||
// Smaller space for smaller devices. Also, top is 0 by default when in scroll.
|
||||
CGFloat verticalSpacing = [[MFSizeObject sizeObjectWithStandardSize:PaddingDefaultVerticalSpacing smalliPhoneSize:PaddingDefault] getValueBasedOnScreenSize];
|
||||
buttonView.leftPin.constant = PaddingDefaultHorizontalSpacing;
|
||||
buttonView.rightPin.constant = PaddingDefaultHorizontalSpacing;
|
||||
buttonView.topPin.constant = [self bottomViewOutsideOfScroll] ? verticalSpacing : 0;
|
||||
buttonView.bottomPin.constant = verticalSpacing;
|
||||
} else {
|
||||
buttonView.topPin.constant = 0;
|
||||
buttonView.bottomPin.constant = 0;
|
||||
@ -101,7 +89,7 @@
|
||||
|
||||
// Removes the bottom view out of scroll if it is there.
|
||||
[self.viewOutOfScroll removeFromSuperview];
|
||||
[StackableViewController removeUIViews:[self.contentView subviews]];
|
||||
[MVMCoreUIStackableViewController removeUIViews:[self.contentView subviews]];
|
||||
|
||||
// Checks if we are using a different object than top labels.
|
||||
UIView *topView = [self useCustomViewInsteadOfLabels];
|
||||
@ -112,7 +100,7 @@
|
||||
topLabelsView.separatorView.hidden = NO;
|
||||
self.topLabelsView = topLabelsView;
|
||||
topView = topLabelsView;
|
||||
self.topView = topView;
|
||||
self.topView = topView;
|
||||
[topLabelsView setWithJSON:[self mapForTopLabels]];
|
||||
}
|
||||
[self.contentView addSubview:topView];
|
||||
@ -122,8 +110,8 @@
|
||||
|
||||
// Checks if we are using a different object than the bottom buttons.
|
||||
UIView *bottomView = [self useCustomViewInsteadOfButtons];
|
||||
self.customBottemView = (bottomView != nil);
|
||||
if (!self.customBottemView) {
|
||||
self.customBottomView = (bottomView != nil);
|
||||
if (!self.customBottomView) {
|
||||
|
||||
// Sets up the buttons/button.
|
||||
NSDictionary *primaryButtonDictionary = [self primaryButtonMap];
|
||||
@ -133,21 +121,20 @@
|
||||
self.primaryButton = buttonView.primaryButton;
|
||||
bottomView = buttonView;
|
||||
self.bottomView = bottomView;
|
||||
} else {
|
||||
self.bottomView = bottomView;
|
||||
}
|
||||
[self updateTopLabelsBottomButtonsPadding];
|
||||
} else {
|
||||
self.bottomView = bottomView;
|
||||
}
|
||||
|
||||
// Adds the bottom view outside the scroll if directed.
|
||||
[self.safeAreaView removeFromSuperview];
|
||||
if ([self bottomViewOutsideOfScroll]) {
|
||||
|
||||
if (!self.customBottemView) {
|
||||
if (!self.customBottomView) {
|
||||
bottomView.backgroundColor = [UIColor mfBackgroundGray];
|
||||
}
|
||||
[self addViewOutsideOfScrollView:bottomView];
|
||||
self.viewOutOfScroll = bottomView;
|
||||
|
||||
|
||||
// Sets this so that the button view added to the content view will be empty.
|
||||
bottomView = [ViewConstrainingView emptyView];
|
||||
}
|
||||
@ -159,7 +146,7 @@
|
||||
|
||||
// Allows addition of any custom ui before custom center view.
|
||||
[self buildInAdditionalViewsBeforeCenteredContent];
|
||||
|
||||
|
||||
|
||||
// Positions the views in between the labels and buttons.
|
||||
UIView *viewBetween = nil;
|
||||
@ -221,18 +208,18 @@
|
||||
|
||||
NSLayoutConstraint *sameHeightSpacer = [NSLayoutConstraint constraintWithItem:topSpacer attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:bottomSpacer attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];
|
||||
sameHeightSpacer.active = YES;
|
||||
|
||||
|
||||
NSLayoutConstraint *minimumHeightSpacer = [NSLayoutConstraint constraintWithItem:topSpacer attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:PaddingDefaultVerticalSpacing];
|
||||
minimumHeightSpacer.active = YES;
|
||||
|
||||
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topBetweenEdgeView]-0-[topSpacer]-0-[viewBetween]-0-[bottomSpacer]-0-[bottomBetweenEdgeView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topBetweenEdgeView,topSpacer,viewBetween,bottomSpacer,bottomBetweenEdgeView)]];
|
||||
} else if (spaceAbove) {
|
||||
|
||||
|
||||
// Space above is set, space below is free.
|
||||
UIView *bottomSpacer = [MVMCoreUICommonViewsUtility commonView];
|
||||
[self.contentView addSubview:bottomSpacer];
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[bottomSpacer]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(bottomSpacer)]];
|
||||
|
||||
|
||||
NSLayoutConstraint *bottomSpacerHeight = [NSLayoutConstraint constraintWithItem:bottomSpacer attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:PaddingDefaultVerticalSpacing];
|
||||
bottomSpacerHeight.active = YES;
|
||||
|
||||
@ -244,7 +231,7 @@
|
||||
UIView *topSpacer = [MVMCoreUICommonViewsUtility commonView];
|
||||
[self.contentView addSubview:topSpacer];
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[topSpacer]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topSpacer)]];
|
||||
|
||||
|
||||
NSLayoutConstraint *topSpacerHeight = [NSLayoutConstraint constraintWithItem:topSpacer attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:PaddingDefaultVerticalSpacing];
|
||||
topSpacerHeight.active = YES;
|
||||
|
||||
@ -258,7 +245,7 @@
|
||||
UIView *spacer = [MVMCoreUICommonViewsUtility commonView];
|
||||
[self.contentView addSubview:spacer];
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[spacer]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(spacer)]];
|
||||
|
||||
|
||||
// Needs the height constraint
|
||||
heightConstraint.active = YES;
|
||||
|
||||
@ -286,19 +273,14 @@
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object {
|
||||
CGFloat horizontal = [MFStyler defaultHorizontalPaddingForApplicationWidth];
|
||||
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object size:(CGFloat)size {
|
||||
CGFloat horizontal = [MFStyler defaultHorizontalPaddingForSize:size];
|
||||
if (self.bottomAccessoryView == object) {
|
||||
return UIEdgeInsetsMake(0, horizontal, PaddingDefaultVerticalSpacing, horizontal);
|
||||
}
|
||||
return UIEdgeInsetsMake(0, horizontal, 0, horizontal);
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
- (void)addViewToContentView:(UIView *)bottomView {
|
||||
|
||||
self.bottomConstraint.active = YES;
|
||||
@ -313,10 +295,10 @@
|
||||
- (void)addViewOutsideOfScrollView:(UIView *)bottomView {
|
||||
|
||||
self.bottomConstraint.active = NO;
|
||||
|
||||
|
||||
// Buttons will be outside of the scrolling view.
|
||||
[self.view addSubview:bottomView];
|
||||
|
||||
|
||||
UIScrollView *scrollview = self.scrollView;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[scrollview]-0-[bottomView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(scrollview,bottomView)]];
|
||||
@ -334,7 +316,6 @@
|
||||
|
||||
#pragma mark - Can Subclass These
|
||||
|
||||
|
||||
- (nullable UIView *)buttonsAccessoryView {
|
||||
return nil;
|
||||
}
|
||||
@ -349,8 +330,6 @@
|
||||
[self.contentView addSubview:constrainingView];
|
||||
self.bottomBetweenEdgeView = constrainingView;
|
||||
self.bottomAccessoryView = constrainingView;
|
||||
|
||||
[constrainingView setPinConstantsWithInsets:[self spaceAroundUIObject:constrainingView]];
|
||||
|
||||
[NSLayoutConstraint constraintPinLeftSubview:constrainingView leftConstant:0];
|
||||
[NSLayoutConstraint constraintPinRightSubview:constrainingView rightConstant:0];
|
||||
@ -373,23 +352,12 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (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);
|
||||
}
|
||||
|
||||
- (NSDictionary*)primaryButtonMap {
|
||||
- (NSDictionary *)primaryButtonMap {
|
||||
NSDictionary *buttonMap = [self.loadObject.pageJSON dict:KeyButtonMap];
|
||||
return [buttonMap dict:KeyPrimaryButton];
|
||||
}
|
||||
|
||||
- (NSDictionary*)secondaryButtonMap {
|
||||
- (NSDictionary *)secondaryButtonMap {
|
||||
NSDictionary *buttonMap = [self.loadObject.pageJSON dict:KeyButtonMap];
|
||||
return [buttonMap dict:KeySecondaryButton];
|
||||
}
|
||||
@ -410,10 +378,8 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - Animations
|
||||
-(void)setupIntroAnimations {
|
||||
- (void)setupIntroAnimations {
|
||||
if (self.topView.subviews) {
|
||||
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topView]];
|
||||
}
|
||||
@ -422,13 +388,6 @@
|
||||
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topBetweenEdgeView]];
|
||||
}
|
||||
|
||||
// NSMutableArray *centerAnimationObjects = [NSMutableArray new];
|
||||
// for (int i = 0; i < self.middleViews.count; i++) {
|
||||
// MVMAnimationObject *aobj =[MVMAnimations fadeUpAnimationWithView:self.middleViews[i]];
|
||||
// [centerAnimationObjects addObject:aobj];
|
||||
// }
|
||||
// [self.introAnimationManager addAnimationGroupWithAnimations:centerAnimationObjects];
|
||||
|
||||
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.betweenView]];
|
||||
|
||||
if (self.bottomBetweenEdgeView.subviews.count) {
|
||||
23
MVMCoreUI/LegacyControllers/StackableViewController.h
Normal file
23
MVMCoreUI/LegacyControllers/StackableViewController.h
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// StackableViewController.h
|
||||
// myverizon
|
||||
//
|
||||
// Created by Scott Pfeil on 3/26/14.
|
||||
// Copyright (c) 2014 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
// This view controller is here to enable faster development of standard form screens. Put all ui objects that you want to be displayed in a top down order in an array and then call the generateFormWithUIArray. Any type can go in it.
|
||||
|
||||
#import <MVMCoreUI/MVMCoreUIStackableViewController.h>
|
||||
|
||||
@interface StackableViewController : MVMCoreUIStackableViewController
|
||||
|
||||
// Returns the spacing that should surround the passed in item. Subclass this to change spacing.
|
||||
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object;
|
||||
|
||||
// When using constraining views in the form array, resets the space that should surround each element.
|
||||
- (void)resetSpaceForFormArrayWithConstrainingViews;
|
||||
|
||||
// Returns the standard space around ui objects.
|
||||
+ (UIEdgeInsets)standardSpaceAroundUIObject;
|
||||
|
||||
@end
|
||||
43
MVMCoreUI/LegacyControllers/StackableViewController.m
Normal file
43
MVMCoreUI/LegacyControllers/StackableViewController.m
Normal file
@ -0,0 +1,43 @@
|
||||
//
|
||||
// StackableViewController.m
|
||||
// myverizon
|
||||
//
|
||||
// Created by Scott Pfeil on 3/26/14.
|
||||
// Copyright (c) 2014 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
#import "StackableViewController.h"
|
||||
#import "MFStyler.h"
|
||||
#import "ViewConstrainingView.h"
|
||||
#import "MVMCoreUIUtility.h"
|
||||
|
||||
@interface StackableViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation StackableViewController
|
||||
|
||||
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object {
|
||||
return [super spaceAroundUIObject:object size:[MVMCoreUIUtility getWidth]];
|
||||
}
|
||||
|
||||
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object size:(CGFloat)size {
|
||||
return [self spaceAroundUIObject:object];
|
||||
}
|
||||
|
||||
- (void)resetSpaceForFormArrayWithConstrainingViews {
|
||||
for (UIView *view in self.formUIArray) {
|
||||
ViewConstrainingView *constrainingView = (ViewConstrainingView *)view.superview;
|
||||
[constrainingView setPinConstantsWithInsets:[self spaceAroundUIObject:view]];
|
||||
}
|
||||
}
|
||||
|
||||
+ (UIEdgeInsets)standardSpaceAroundUIObject {
|
||||
return [super standardSpaceAroundUIObjectForSize:[MVMCoreUIUtility getWidth]];
|
||||
}
|
||||
|
||||
+ (UIEdgeInsets)standardSpaceAroundUIObjectForSize:(CGFloat)size {
|
||||
return [self standardSpaceAroundUIObject];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,28 @@
|
||||
//
|
||||
// TopLabelsAndBottomButtonsViewController.h
|
||||
// myverizon
|
||||
//
|
||||
// Created by Scott Pfeil on 1/26/16.
|
||||
// Copyright © 2016 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
// Has top labels docked on top, buttons docked on bottom, and anything you'd like in between when subclassed.
|
||||
|
||||
#import <MVMCoreUI/MVMCoreUIThreeLayerViewController.h>
|
||||
#import <MVMCoreUI/ViewConstrainingView.h>
|
||||
#import <MVMCoreUI/StackableViewController.h>
|
||||
#import <MVMCoreUI/TopLabelsView.h>
|
||||
@class LabelView;
|
||||
|
||||
@interface TopLabelsAndBottomButtonsViewController : MVMCoreUIThreeLayerViewController
|
||||
|
||||
// Can override. This is put in because to cover 90% of the screens for initial ipad release, need to rebuild ui (newDataBuildScreen) of size of view change in updateViews. Disable this to handle manually with more finess.
|
||||
@property (nonatomic) BOOL rebuildUIOnSizeChange;
|
||||
|
||||
// Can overwrite the default padding for labels and buttons.
|
||||
- (UIEdgeInsets)paddingForTopLabels;
|
||||
- (UIEdgeInsets)paddingForBottomButtons;
|
||||
|
||||
// Returns the spacing that should surround the passed in item. Subclass this to change spacing.
|
||||
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object;
|
||||
|
||||
@end
|
||||
@ -0,0 +1,92 @@
|
||||
//
|
||||
// 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
|
||||
@ -49,6 +49,8 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
|
||||
#import <MVMCoreUI/MFScrollingViewController.h>
|
||||
#import <MVMCoreUI/ProgrammaticScrollViewController.h>
|
||||
#import <MVMCoreUI/MFProgrammaticTableViewController.h>
|
||||
#import <MVMCoreUI/MVMCoreUIStackableViewController.h>
|
||||
#import <MVMCoreUI/MVMCoreUIThreeLayerViewController.h>
|
||||
#import <MVMCoreUI/StackableViewController.h>
|
||||
#import <MVMCoreUI/MFLoadingViewController.h>
|
||||
#import <MVMCoreUI/TopLabelsAndBottomButtonsViewController.h>
|
||||
|
||||
@ -7,12 +7,11 @@
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <MVMCoreUI/TopLabelsAndBottomButtonsViewController.h>
|
||||
#import <MVMCoreUI/MVMCoreUIThreeLayerViewController.h>
|
||||
@class LabelView;
|
||||
@class LabelWithInternalButton;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MVMCoreUILargeHeaderSingleLabelTemplate : TopLabelsAndBottomButtonsViewController
|
||||
@interface MVMCoreUILargeHeaderSingleLabelTemplate : MVMCoreUIThreeLayerViewController
|
||||
|
||||
// A label that can go below the top labels. Can be a normal label or one with internal buttons.
|
||||
@property (nullable, weak, nonatomic) LabelView *labelViewUnderTopLabels;
|
||||
@ -25,5 +24,3 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (nullable NSDictionary *)actionMapForLabelUnderTopLabelsWithInternalButton;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#import "LabelView.h"
|
||||
#import "LabelWithInternalButton.h"
|
||||
#import "UIColor+MFConvenience.h"
|
||||
#import "TopLabelsView.h"
|
||||
|
||||
@interface MVMCoreUILargeHeaderSingleLabelTemplate ()
|
||||
|
||||
@ -23,11 +24,6 @@
|
||||
[self.topLabelsView.separatorView hide];
|
||||
}
|
||||
|
||||
- (void)initialLoad {
|
||||
[super initialLoad];
|
||||
self.rebuildUIOnSizeChange = NO;
|
||||
}
|
||||
|
||||
- (nullable NSArray <UIView *>*)buildViewsBetweenLabelsAndButtons {
|
||||
NSDictionary *labelActionMap = [self actionMapForLabelUnderTopLabelsWithInternalButton];
|
||||
NSString *labelString = [self stringForLabelUnderTopLabels];
|
||||
@ -76,10 +72,9 @@
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
- (UIEdgeInsets)paddingForTopLabels {
|
||||
UIEdgeInsets edge = [super paddingForTopLabels];
|
||||
edge.bottom = PaddingTwo;
|
||||
return edge;
|
||||
- (void)updateTopLabelsPadding:(CGFloat)size {
|
||||
[super updateTopLabelsPadding:size];
|
||||
self.topLabelsView.bottomLabelConstraint.constant = PaddingTwo;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -49,6 +49,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - Sizing
|
||||
|
||||
// Grabs the width from the available container.
|
||||
+ (CGFloat)getWidth;
|
||||
|
||||
// Gets the space needed at the top of the view for the status bar.
|
||||
+ (CGFloat)getTopSpaceWithStatusBarForView:(UIView *_Nonnull)view;
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
#import "MVMCoreUIUtility.h"
|
||||
#import "MVMCoreUIConstants.h"
|
||||
#import "MVMCoreUISession.h"
|
||||
@import MVMCore.MVMCoreNavigationHandler;
|
||||
@import MVMCore.MVMCoreGetterUtility;
|
||||
|
||||
@ -97,6 +98,15 @@
|
||||
|
||||
#pragma mark - Sizing
|
||||
|
||||
+ (CGFloat)getWidth {
|
||||
UIViewController *controller = [MVMCoreUISession sharedGlobal].splitViewController ?: [MVMCoreUISession sharedGlobal].navigationController ?: [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
if (controller) {
|
||||
return CGRectGetWidth(controller.view.bounds);
|
||||
} else {
|
||||
return CGRectGetWidth([UIScreen mainScreen].bounds);
|
||||
}
|
||||
}
|
||||
|
||||
+ (CGFloat)getTopSpaceWithStatusBarForView:(UIView *)view {
|
||||
CGPoint viewStartPointInWindowSpace = [[UIApplication sharedApplication].keyWindow convertPoint:CGPointMake(CGRectGetMinX(view.frame), CGRectGetMinY(view.frame)) fromView:[view superview]];
|
||||
if (CGRectGetMaxY([UIApplication sharedApplication].statusBarFrame) > viewStartPointInWindowSpace.y) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user