Convert files to swift and simplify

undo top labels bottom buttons view changes
molecule delegates and spacing blocks
Primary Button Molecule
remove module name from swift files.
This commit is contained in:
Pfeil, Scott Robert 2019-02-13 23:16:52 -05:00
parent 7373667f59
commit 81375ab196
23 changed files with 904 additions and 752 deletions

View File

@ -19,8 +19,6 @@
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 */; };
@ -34,8 +32,6 @@
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, ); }; };
D29DF0E221E4F3B6003B2FB9 /* MVMCoreUILargeHeaderSingleLabelTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF0E021E4F3B6003B2FB9 /* MVMCoreUILargeHeaderSingleLabelTemplate.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF0E321E4F3B6003B2FB9 /* MVMCoreUILargeHeaderSingleLabelTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF0E121E4F3B6003B2FB9 /* MVMCoreUILargeHeaderSingleLabelTemplate.m */; };
D29DF0E621E4F3C7003B2FB9 /* MVMCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D29DF0E521E4F3C7003B2FB9 /* MVMCore.framework */; };
D29DF11521E6805F003B2FB9 /* UIColor+MFConvenience.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF11121E6805F003B2FB9 /* UIColor+MFConvenience.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF11621E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF11221E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -155,9 +151,12 @@
D2A514592211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A514572211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.m */; };
D2A5145D2211D22A00345BFB /* MVMCoreUIMoleculeViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D2A5145C2211D22A00345BFB /* MVMCoreUIMoleculeViewProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
D2A5145F2211DDC100345BFB /* MVMCoreUIMoleculeStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A5145E2211DDC100345BFB /* MVMCoreUIMoleculeStackView.swift */; };
D2A5146122121FBF00345BFB /* MVMCoreUIMoleculeStackTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A5146022121FBF00345BFB /* MVMCoreUIMoleculeStackTemplate.swift */; };
D2A514632213643100345BFB /* MVMCoreUIMoleculeStackCenteredTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A514622213643100345BFB /* MVMCoreUIMoleculeStackCenteredTemplate.swift */; };
D2A5146122121FBF00345BFB /* MoleculeStackTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A5146022121FBF00345BFB /* MoleculeStackTemplate.swift */; };
D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A514622213643100345BFB /* MoleculeStackCenteredTemplate.swift */; };
D2A514672213885800345BFB /* MVMCoreUIHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A514662213885800345BFB /* MVMCoreUIHeaderView.swift */; };
D2A514692213B5FB00345BFB /* PrimaryButtonViewMoleculeProtocolExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A514682213B5FB00345BFB /* PrimaryButtonViewMoleculeProtocolExtension.swift */; };
D2A5146B2214905000345BFB /* ThreeLayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */; };
D2A5146D2214C1E400345BFB /* LegacyLargeHeaderSingleLabelTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A5146C2214C1E400345BFB /* LegacyLargeHeaderSingleLabelTemplate.swift */; };
D2C5001821F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h in Headers */ = {isa = PBXBuildFile; fileRef = D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */ = {isa = PBXBuildFile; fileRef = D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */; };
D2C5001D21F8EE67001DA659 /* LabelWithInternalButton.h in Headers */ = {isa = PBXBuildFile; fileRef = D2C5001B21F8EE66001DA659 /* LabelWithInternalButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -177,8 +176,6 @@
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>"; };
@ -194,8 +191,6 @@
D29DF0CC21E404D4003B2FB9 /* MVMCoreUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MVMCoreUI.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D29DF0CF21E404D4003B2FB9 /* MVMCoreUI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUI.h; sourceTree = "<group>"; };
D29DF0D021E404D4003B2FB9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D29DF0E021E4F3B6003B2FB9 /* MVMCoreUILargeHeaderSingleLabelTemplate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUILargeHeaderSingleLabelTemplate.h; sourceTree = "<group>"; };
D29DF0E121E4F3B6003B2FB9 /* MVMCoreUILargeHeaderSingleLabelTemplate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUILargeHeaderSingleLabelTemplate.m; sourceTree = "<group>"; };
D29DF0E521E4F3C7003B2FB9 /* MVMCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MVMCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D29DF11121E6805F003B2FB9 /* UIColor+MFConvenience.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+MFConvenience.h"; sourceTree = "<group>"; };
D29DF11221E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSLayoutConstraint+MFConvenience.h"; sourceTree = "<group>"; };
@ -317,9 +312,12 @@
D2A514572211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIMoleculeMappingObject.m; sourceTree = "<group>"; };
D2A5145C2211D22A00345BFB /* MVMCoreUIMoleculeViewProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIMoleculeViewProtocol.h; sourceTree = "<group>"; };
D2A5145E2211DDC100345BFB /* MVMCoreUIMoleculeStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUIMoleculeStackView.swift; sourceTree = "<group>"; };
D2A5146022121FBF00345BFB /* MVMCoreUIMoleculeStackTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUIMoleculeStackTemplate.swift; sourceTree = "<group>"; };
D2A514622213643100345BFB /* MVMCoreUIMoleculeStackCenteredTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUIMoleculeStackCenteredTemplate.swift; sourceTree = "<group>"; };
D2A5146022121FBF00345BFB /* MoleculeStackTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeStackTemplate.swift; sourceTree = "<group>"; };
D2A514622213643100345BFB /* MoleculeStackCenteredTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeStackCenteredTemplate.swift; sourceTree = "<group>"; };
D2A514662213885800345BFB /* MVMCoreUIHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUIHeaderView.swift; sourceTree = "<group>"; };
D2A514682213B5FB00345BFB /* PrimaryButtonViewMoleculeProtocolExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryButtonViewMoleculeProtocolExtension.swift; sourceTree = "<group>"; };
D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeLayerViewController.swift; sourceTree = "<group>"; };
D2A5146C2214C1E400345BFB /* LegacyLargeHeaderSingleLabelTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyLargeHeaderSingleLabelTemplate.swift; sourceTree = "<group>"; };
D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewControllerMappingObject.h; sourceTree = "<group>"; };
D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIViewControllerMappingObject.m; sourceTree = "<group>"; };
D2C5001B21F8EE66001DA659 /* LabelWithInternalButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelWithInternalButton.h; sourceTree = "<group>"; };
@ -394,10 +392,9 @@
isa = PBXGroup;
children = (
01DF566F21FA5AB300CC099B /* MVMCoreUITextFieldListFormViewController.swift */,
D29DF0E021E4F3B6003B2FB9 /* MVMCoreUILargeHeaderSingleLabelTemplate.h */,
D29DF0E121E4F3B6003B2FB9 /* MVMCoreUILargeHeaderSingleLabelTemplate.m */,
D2A5146022121FBF00345BFB /* MVMCoreUIMoleculeStackTemplate.swift */,
D2A514622213643100345BFB /* MVMCoreUIMoleculeStackCenteredTemplate.swift */,
D2A5146C2214C1E400345BFB /* LegacyLargeHeaderSingleLabelTemplate.swift */,
D2A5146022121FBF00345BFB /* MoleculeStackTemplate.swift */,
D2A514622213643100345BFB /* MoleculeStackCenteredTemplate.swift */,
);
path = Templates;
sourceTree = "<group>";
@ -429,6 +426,7 @@
D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */,
D29770F621F7C73800B2F0D0 /* PrimaryButtonView.h */,
D29770F721F7C73800B2F0D0 /* PrimaryButtonView.m */,
D2A514682213B5FB00345BFB /* PrimaryButtonViewMoleculeProtocolExtension.swift */,
D2A514662213885800345BFB /* MVMCoreUIHeaderView.swift */,
D2A5145C2211D22A00345BFB /* MVMCoreUIMoleculeViewProtocol.h */,
D2A5145E2211DDC100345BFB /* MVMCoreUIMoleculeStackView.swift */,
@ -451,8 +449,7 @@
D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */,
D29DF2CC21E7C104003B2FB9 /* MFLoadingViewController.h */,
D29DF2CD21E7C104003B2FB9 /* MFLoadingViewController.m */,
D22D1F592204D2C00077CEC0 /* MVMCoreUIThreeLayerViewController.h */,
D22D1F5A2204D2C00077CEC0 /* MVMCoreUIThreeLayerViewController.m */,
D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */,
);
path = BaseControllers;
sourceTree = "<group>";
@ -732,7 +729,6 @@
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 */,
@ -742,7 +738,6 @@
D29DF28B21E7AC2B003B2FB9 /* ViewConstrainingView.h in Headers */,
D29DF2B321E7B76D003B2FB9 /* MFLoadingSpinner.h in Headers */,
D29DF28921E7AC2B003B2FB9 /* MFLabel.h in Headers */,
D29DF0E221E4F3B6003B2FB9 /* MVMCoreUILargeHeaderSingleLabelTemplate.h in Headers */,
D29DF32521ED0DA2003B2FB9 /* TextButtonView.h in Headers */,
D29DF25021E6A177003B2FB9 /* MFDigitTextBox.h in Headers */,
D29DF2C621E7BF57003B2FB9 /* MFTabBarInteractor.h in Headers */,
@ -875,6 +870,7 @@
D29DF17C21E69E1F003B2FB9 /* MFTextButton.m in Sources */,
D29DF2C521E7BF57003B2FB9 /* MFTabBarSwipeAnimator.m in Sources */,
D29DF2B421E7B76D003B2FB9 /* MFLoadingSpinner.m in Sources */,
D2A514692213B5FB00345BFB /* PrimaryButtonViewMoleculeProtocolExtension.swift in Sources */,
D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */,
D29DF12E21E6851E003B2FB9 /* MVMCoreUITopAlertView.m in Sources */,
D29DF2CF21E7C104003B2FB9 /* MFLoadingViewController.m in Sources */,
@ -891,9 +887,9 @@
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 */,
D2A5146D2214C1E400345BFB /* LegacyLargeHeaderSingleLabelTemplate.swift in Sources */,
D29DF18121E69E50003B2FB9 /* MFView.m in Sources */,
D29DF18321E69E54003B2FB9 /* SeparatorView.m in Sources */,
D29DF17A21E69E1F003B2FB9 /* MFCustomButton.m in Sources */,
@ -904,6 +900,7 @@
D206997821FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m in Sources */,
D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */,
01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */,
D2A5146B2214905000345BFB /* ThreeLayerViewController.swift in Sources */,
D29DF2C921E7BFC6003B2FB9 /* MFSizeObject.m in Sources */,
D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */,
D29DF2A521E7B2A0003B2FB9 /* MFCaretView.m in Sources */,
@ -917,18 +914,17 @@
D29DF29821E7ADB8003B2FB9 /* MFScrollingViewController.m in Sources */,
D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */,
D29DF2AA21E7B2F9003B2FB9 /* MVMCoreUIConstants.m in Sources */,
D2A5146122121FBF00345BFB /* MVMCoreUIMoleculeStackTemplate.swift in Sources */,
D2A5146122121FBF00345BFB /* MoleculeStackTemplate.swift in Sources */,
D29DF17821E69E1F003B2FB9 /* MFCaretButton.m in Sources */,
D29DF11821E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.m in Sources */,
D29DF26C21E6AA0B003B2FB9 /* FLAnimatedImage.m in Sources */,
D29770FC21F7C77400B2F0D0 /* MVMCoreUITextFieldView.m in Sources */,
D29DF25121E6A177003B2FB9 /* MFDigitTextBox.m in Sources */,
D29DF13221E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.m in Sources */,
D29DF0E321E4F3B6003B2FB9 /* MVMCoreUILargeHeaderSingleLabelTemplate.m in Sources */,
D2C5001E21F8EE67001DA659 /* LabelWithInternalButton.m in Sources */,
D29DF29C21E7ADB9003B2FB9 /* MFProgrammaticTableViewController.m in Sources */,
D29DF2BE21E7BEA4003B2FB9 /* TopTabbar.m in Sources */,
D2A514632213643100345BFB /* MVMCoreUIMoleculeStackCenteredTemplate.swift in Sources */,
D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */,
D29DF32421ED0DA2003B2FB9 /* TextButtonView.m in Sources */,
D29DF29E21E7AE3B003B2FB9 /* MFStyler.m in Sources */,
D2A514592211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.m in Sources */,

View File

@ -1,71 +0,0 @@
//
// MVMCoreUIThreeLayerViewController.h
// MVMCoreUI
//
// Created by Scott Pfeil on 2/1/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
#import <MVMCoreUI/MVMCoreUIStackableViewController.h>
@class TopLabelsView;
@class PrimaryButton;
@interface MVMCoreUIThreeLayerViewController : MVMCoreUIStackableViewController
@property (nullable, weak, nonatomic) TopLabelsView *topLabelsView;
@property (nullable, weak, nonatomic) PrimaryButton *primaryButton;
@property (nullable, weak, nonatomic) PrimaryButton *secondaryButton;
@property (nullable, weak, nonatomic, readonly) UIView *bottomView;
@property (nullable, weak, nonatomic, readonly) UIView *topView;
@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.
@property (nullable, weak, nonatomic) UIView *topBetweenEdgeView;
@property (nullable, weak, nonatomic) UIView *bottomBetweenEdgeView;
// The constraint connecting the topLabelsView to the content view.
@property (nullable, strong, nonatomic) NSLayoutConstraint *topConstraintForTopView;
#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;
//*********
// If both are subclassed to return a value, then the buttons will not be pinned towards the bottom.
// If anything is returned, the class will fill in the space between the top labels and views with the passed in value.
- (nullable NSNumber *)spaceAboveBetweenView;
// If anything is returned, the class will fill in the space between the views and bottom buttons with the passed in value.
- (nullable NSNumber *)spaceBelowBetweenView;
// Can overwrite the default padding for labels and buttons.
- (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;
- (nullable NSDictionary *)primaryButtonMap;
// Should not sub class it, for most cases, the headline and message will be in page map, but who knows how server wants to send them in certain pages
- (nullable NSDictionary *)mapForTopLabels;
// Use these if you want to replace the top labels or bottom button views with your own views.
- (nullable UIView *)useCustomViewInsteadOfLabels;
- (nullable UIView *)useCustomViewInsteadOfButtons;
// Can override if the buttons should be outside of the scroll or not. Default is no.
- (BOOL)bottomViewOutsideOfScroll;
// Build above the button view
- (nullable UIView *)buttonsAccessoryView;
@end

View File

@ -1,408 +0,0 @@
//
// MVMCoreUIThreeLayerViewController.m
// MVMCoreUI
//
// Created by Scott Pfeil on 2/1/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
#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 MVMCoreUIThreeLayerViewController ()
@property (nullable, strong, nonatomic) NSLayoutConstraint *heightConstraint;
@property (nullable, weak, nonatomic) UIView *topView;
@property (nullable, weak, nonatomic) UIView *bottomView;
@property (nonatomic, readwrite) BOOL customBottomView;
@property (nullable, weak, nonatomic) NSArray *middleViews;
@property (nullable, weak, nonatomic) UIView *betweenView;
@property (nullable, weak, nonatomic) ViewConstrainingView *bottomAccessoryView;
// Adds the button view to the screen. Out of the scroll or in.
- (void)addViewOutsideOfScrollView:(UIView *)bottomView;
- (void)addViewToContentView:(UIView *)bottomView;
@end
@implementation MVMCoreUIThreeLayerViewController
- (void)updateViews {
[super updateViews];
// 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)updateBottomButtonsPadding:(CGFloat)size {
if (!self.customBottomView) {
PrimaryButtonView *buttonView = (PrimaryButtonView *)self.bottomView;
if (self.secondaryButton || self.primaryButton) {
// 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;
buttonView.leftPin.constant = 0;
buttonView.rightPin.constant = 0;
}
}
}
- (void)newDataBuildScreen {
[super newDataBuildScreen];
// Removes the bottom view out of scroll if it is there.
[self.viewOutOfScroll removeFromSuperview];
[MVMCoreUIStackableViewController removeUIViews:[self.contentView subviews]];
// Checks if we are using a different object than top labels.
UIView *topView = [self useCustomViewInsteadOfLabels];
self.topView = topView;
if (!topView) {
NSDictionary *mapForTopLabels = [self mapForTopLabels];
if (mapForTopLabels) {
// Sets up the labels toward the top of the screen.
TopLabelsView *topLabelsView = [[TopLabelsView alloc] initWithFrame:CGRectZero];
topLabelsView.separatorView.hidden = NO;
self.topLabelsView = topLabelsView;
topView = topLabelsView;
self.topView = topView;
[topLabelsView setWithJSON:[self mapForTopLabels]];
} else {
topView = [MVMCoreUICommonViewsUtility commonView];
[topView.heightAnchor constraintEqualToConstant:0].active = YES;
self.topView = topView;
}
}
[self.contentView addSubview:topView];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[topView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topView)]];
self.topConstraintForTopView = [NSLayoutConstraint constraintWithItem:topView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
self.topConstraintForTopView.active = YES;
// Checks if we are using a different object than the bottom buttons.
UIView *bottomView = [self useCustomViewInsteadOfButtons];
self.customBottomView = (bottomView != nil);
if (!self.customBottomView) {
// Sets up the buttons/button.
NSDictionary *primaryButtonDictionary = [self primaryButtonMap];
NSDictionary *secondaryButtonDictionary = [self secondaryButtonMap];
PrimaryButtonView *buttonView = [[PrimaryButtonView alloc] initWithPrimaryButtonMap:primaryButtonDictionary secondaryButtonMap:secondaryButtonDictionary actionDelegate:self additionalData:nil buttonDelegate:self];
self.secondaryButton = buttonView.secondaryButton;
self.primaryButton = buttonView.primaryButton;
bottomView = buttonView;
self.bottomView = bottomView;
} else {
self.bottomView = bottomView;
}
// Adds the bottom view outside the scroll if directed.
[self.safeAreaView removeFromSuperview];
if ([self bottomViewOutsideOfScroll]) {
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];
}
// Adds either the bottom view or a blank view inside the scroll.
self.viewInScroll = bottomView;
[self addViewToContentView:bottomView];
// Allows addition of any custom ui before custom center view.
[self buildInAdditionalViewsBeforeCenteredContent];
// Positions the views in between the labels and buttons.
UIView *viewBetween = nil;
NSArray *views = [self buildViewsBetweenLabelsAndButtons];
self.middleViews = views;
if (views.count > 0) {
viewBetween = [MVMCoreUICommonViewsUtility commonView];
[self generateFormView:viewBetween withUIArrayForConstrainingViews:views];
[self.contentView addSubview:viewBetween];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[viewBetween]-0@900-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(viewBetween)]];
[viewBetween setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
}
self.betweenView = viewBetween;
// This whole section is for handling vertical spacing.
//-------------------------------------------------------------
UIView *topBetweenEdgeView = topView;
if (self.topBetweenEdgeView) {
topBetweenEdgeView = self.topBetweenEdgeView;
}
UIView *bottomBetweenEdgeView = bottomView;
if (self.bottomBetweenEdgeView) {
bottomBetweenEdgeView = self.bottomBetweenEdgeView;
}
// Sets the height so when there is not enough content, the bottom buttons will stay pinned. But if there is too much content, the constraint has low priority so the screen will scroll. Only made active in certain conditions.
NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintWithItem:self.contentView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.scrollView attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];
heightConstraint.priority = UILayoutPriorityDefaultLow;
self.heightConstraint = heightConstraint;
if (viewBetween) {
// These spacer views are what causes the buttons to be pinned to the bottom.
NSNumber *spaceAbove = [self spaceAboveBetweenView];
NSNumber *spaceBelow = [self spaceBelowBetweenView];
if (spaceAbove && spaceBelow) {
// Both top and bottom space set, buttons not pinned to bottom.
NSDictionary *verticalMetrics = @{@"top":spaceAbove,@"bottom":spaceBelow};
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topBetweenEdgeView]-top-[viewBetween]-bottom-[bottomBetweenEdgeView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:verticalMetrics views:NSDictionaryOfVariableBindings(topBetweenEdgeView,viewBetween,bottomBetweenEdgeView)]];
} else {
// Needs the height constraint
heightConstraint.active = YES;
if (!spaceAbove && !spaceBelow) {
// No set space above or below, make the spacers the same height with a default minimum.
UIView *topSpacer = [MVMCoreUICommonViewsUtility commonView];
UIView *bottomSpacer = [MVMCoreUICommonViewsUtility commonView];
[self.contentView addSubview:topSpacer];
[self.contentView addSubview:bottomSpacer];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[topSpacer]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topSpacer)]];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[bottomSpacer]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(bottomSpacer)]];
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;
NSDictionary *verticalMetrics = @{@"top":spaceAbove};
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topBetweenEdgeView]-top-[viewBetween]-0-[bottomSpacer]-0-[bottomBetweenEdgeView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:verticalMetrics views:NSDictionaryOfVariableBindings(topBetweenEdgeView,viewBetween,bottomSpacer,bottomBetweenEdgeView)]];
} else if (spaceBelow) {
// Space below is set, space above is free.
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;
NSDictionary *verticalMetrics = @{@"bottom":spaceBelow};
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topBetweenEdgeView]-0-[topSpacer]-0-[viewBetween]-bottom-[bottomBetweenEdgeView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:verticalMetrics views:NSDictionaryOfVariableBindings(topBetweenEdgeView,topSpacer,viewBetween,bottomBetweenEdgeView)]];
}
}
} else {
// No views in between. Just messages and buttons
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;
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topBetweenEdgeView]-0-[spacer]-0-[bottomBetweenEdgeView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topBetweenEdgeView,spacer,bottomBetweenEdgeView)]];
}
}
- (void)updateViewConstraints {
[super updateViewConstraints];
// Updates for ios 11
if (@available(iOS 11.0, *)) {
if (self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic) {
self.heightConstraint.constant = -self.scrollView.adjustedContentInset.top - self.scrollView.adjustedContentInset.bottom;
} else {
self.heightConstraint.constant = -self.scrollView.contentInset.top - self.scrollView.contentInset.bottom;
}
} else {
self.heightConstraint.constant = -self.scrollView.contentInset.top - self.scrollView.contentInset.bottom;
}
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (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)addViewToContentView:(UIView *)bottomView {
self.bottomConstraint.active = YES;
// Buttons will be at the bottom of the content view.
[self.contentView addSubview:bottomView];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[bottomView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(bottomView)]];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[bottomView]-0@900-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(bottomView)]];
}
- (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)]];
[self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:bottomView.bottomAnchor].active = YES;
UIView *safeAreaView = [MVMCoreUICommonViewsUtility getAndSetupSafeAreaViewOnView:self.view];
safeAreaView.backgroundColor = bottomView.backgroundColor;
self.safeAreaView = safeAreaView;
} else {
// Fallback on earlier versions
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[scrollview]-0-[bottomView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(scrollview,bottomView)]];
}
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[bottomView]-0@900-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(bottomView)]];
}
#pragma mark - Can Subclass These
- (nullable UIView *)buttonsAccessoryView {
return nil;
}
- (void)buildInAdditionalViewsBeforeCenteredContent {
UIView *accessoryView = [self buttonsAccessoryView];
if (accessoryView) {
accessoryView.translatesAutoresizingMaskIntoConstraints = NO;
ViewConstrainingView *constrainingView = [ViewConstrainingView viewConstrainingView:accessoryView];
constrainingView.updateViewHorizontalDefaults = YES;
[self.contentView addSubview:constrainingView];
self.bottomBetweenEdgeView = constrainingView;
self.bottomAccessoryView = constrainingView;
[NSLayoutConstraint constraintPinLeftSubview:constrainingView leftConstant:0];
[NSLayoutConstraint constraintPinRightSubview:constrainingView rightConstant:0];
[NSLayoutConstraint constraintPinFirstView:constrainingView toSecondView:self.viewInScroll
withConstant:0 directionVertical:YES];
} else {
self.bottomAccessoryView = nil;
}
}
- (nullable NSArray <UIView *>*)buildViewsBetweenLabelsAndButtons {
return nil;
}
- (nullable NSNumber *)spaceAboveBetweenView {
return nil;
}
- (nullable NSNumber *)spaceBelowBetweenView {
return nil;
}
- (NSDictionary *)primaryButtonMap {
NSDictionary *buttonMap = [self.loadObject.pageJSON dict:KeyButtonMap];
return [buttonMap dict:KeyPrimaryButton];
}
- (NSDictionary *)secondaryButtonMap {
NSDictionary *buttonMap = [self.loadObject.pageJSON dict:KeyButtonMap];
return [buttonMap dict:KeySecondaryButton];
}
- (nullable NSDictionary *)mapForTopLabels {
return self.loadObject.pageJSON;
}
- (nullable UIView *)useCustomViewInsteadOfLabels {
return nil;
}
- (nullable UIView *)useCustomViewInsteadOfButtons {
return nil;
}
- (BOOL)bottomViewOutsideOfScroll {
return NO;
}
#pragma mark - Animations
- (void)setupIntroAnimations {
if (self.topView.subviews) {
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topView]];
}
if (self.topBetweenEdgeView.subviews.count) {
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topBetweenEdgeView]];
}
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.betweenView]];
if (self.bottomBetweenEdgeView.subviews.count) {
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.bottomBetweenEdgeView]];
}
if (self.bottomView.subviews) {
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.bottomView]];
}
}
@end

View File

@ -0,0 +1,260 @@
//
// MVMCoreUIThreeLayerViewController.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 2/13/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
// This class has three views, a top, middle, and bottom. The top view is just the first view in the scrollview. The middle can be aligned center, top, or bottom depending on if spaceBetweenTopAndMiddle() or spaceBetweenMiddleAndBottom() return values. The bottom view, if inside the scrollview, appears pinned to the bottom unless content pushes it off the screen. If outside the scroll, it's pinned to the bottom under the scrollview.
import UIKit
import MVMAnimationFramework
public class ThreeLayerViewController: ProgrammaticScrollViewController {
// The three main views
var topView: UIView?
var middleView: UIView?
var bottomView: UIView?
// The bottom view can be put outside of the scrolling area.
var bottomViewOutsideOfScroll = false
private var safeAreaView: UIView?
private var heightConstraint: NSLayoutConstraint?
public override func updateViews() {
super.updateViews()
let width = view.bounds.width
if let topView = topView as? MVMCoreViewProtocol {
topView.updateView(width)
}
if let middleView = middleView as? MVMCoreViewProtocol {
middleView.updateView(width)
}
if let bottomView = bottomView as? MVMCoreViewProtocol {
bottomView.updateView(width)
}
}
public override func updateViewConstraints() {
super.updateViewConstraints()
guard let scrollView = scrollView else {
return
}
if #available(iOS 11.0, *), scrollView.contentInsetAdjustmentBehavior == UIScrollView.ContentInsetAdjustmentBehavior.automatic {
heightConstraint?.constant = -scrollView.adjustedContentInset.top - scrollView.adjustedContentInset.bottom
} else {
heightConstraint?.constant = -scrollView.contentInset.top - scrollView.contentInset.bottom
}
}
public override func loadView() {
super.loadView()
// The height is used to keep the bottom view at the bottom.
if let contentView = contentView, let scrollView = scrollView {
heightConstraint = contentView.heightAnchor.constraint(equalTo: scrollView.heightAnchor, multiplier: 1.0)
heightConstraint?.priority = UILayoutPriority.defaultLow
}
}
public override func newDataBuildScreen() {
super.newDataBuildScreen()
// Removes the views
topView?.removeFromSuperview()
middleView?.removeFromSuperview()
bottomView?.removeFromSuperview()
safeAreaView?.removeFromSuperview()
MVMCoreUIStackableViewController.remove(contentView?.subviews)
// Reset constraints
bottomConstraint?.isActive = true
heightConstraint?.isActive = false
setupLayers()
}
//MARK:-Functions to subclass
// Subclass for a top view.
public func viewForTop() -> UIView? {
return nil
}
// Subclass for a middle view.
public func viewForMiddle() -> UIView? {
return nil
}
// Subclass for a bottom view.
public func viewForBottom() -> UIView? {
return nil
}
// If a value is set, the middle view is pinned this value below the top view, if not, space is left to fill.
public func spaceBetweenTopAndMiddle() -> CGFloat? {
return nil
}
// If a value is set, the middle view is pinned this value above the bottom view, if not, space is left to fill.
public func spaceBetweenMiddleAndBottom() -> CGFloat? {
return nil
}
}
//MARK:-Setup
extension ThreeLayerViewController {
func setupViewAsTop() -> UIView? {
if let topView = viewForTop() {
self.topView = topView
} else {
topView = MVMCoreUICommonViewsUtility.commonView()
topView?.heightAnchor.constraint(equalToConstant: 0).isActive = true
}
guard let topView = topView, let contentView = contentView else {
return nil
}
contentView.addSubview(topView)
topView.leftAnchor.constraint(equalTo: contentView.leftAnchor).isActive = true
contentView.rightAnchor.constraint(equalTo: topView.rightAnchor).isActive = true
topView.topAnchor.constraint(equalTo: contentView.topAnchor).isActive = true
return topView
}
func setupViewAsMiddle() -> UIView? {
if let middleView = viewForMiddle() {
self.middleView = middleView
} else {
middleView = MVMCoreUICommonViewsUtility.commonView()
middleView?.heightAnchor.constraint(equalToConstant: 0).isActive = true
}
guard let middleView = middleView, let contentView = contentView else {
return nil
}
contentView.addSubview(middleView)
middleView.leftAnchor.constraint(equalTo: contentView.leftAnchor).isActive = true
contentView.rightAnchor.constraint(equalTo: middleView.rightAnchor).isActive = true
middleView.setContentHuggingPriority(UILayoutPriority.required, for: NSLayoutConstraint.Axis.vertical)
return middleView
}
func setupViewAsBottom() -> UIView? {
if let bottomView = viewForBottom() {
self.bottomView = bottomView
} else {
bottomView = MVMCoreUICommonViewsUtility.commonView()
bottomView?.heightAnchor.constraint(equalToConstant: 0).isActive = true
}
guard let bottomView = bottomView else {
return nil
}
// Adds the bottom view outside the scroll if directed.
if bottomViewOutsideOfScroll {
bottomConstraint?.isActive = false;
addViewInsideOfScrollViewBottom(ViewConstrainingView.empty())
addViewOutsideOfScrollViewBottom(bottomView)
} else {
bottomConstraint?.isActive = true;
addViewInsideOfScrollViewBottom(bottomView)
}
return bottomView
}
func setupLayers() {
guard let contentView = contentView, let topView = setupViewAsTop(), let middleView = setupViewAsMiddle(), let bottomView = setupViewAsBottom() else {
return
}
let spaceAbove = spaceBetweenTopAndMiddle()
let spaceBelow = spaceBetweenMiddleAndBottom()
if let spaceAbove = spaceAbove, let spaceBelow = spaceBelow {
// Both top and bottom space set, buttons not pinned to bottom.
middleView.topAnchor.constraint(equalTo: topView.bottomAnchor, constant: spaceAbove).isActive = true
bottomView.topAnchor.constraint(equalTo: middleView.bottomAnchor, constant: spaceBelow).isActive = true
} else {
heightConstraint?.isActive = true
if let spaceAbove = spaceAbove {
// Space above is set, space below is free.
let bottomSpacer = MVMCoreUICommonViewsUtility.commonView()
contentView.addSubview(bottomSpacer)
bottomSpacer.leftAnchor.constraint(equalTo: contentView.leftAnchor).isActive = true
contentView.rightAnchor.constraint(equalTo: bottomSpacer.rightAnchor).isActive = true
bottomSpacer.heightAnchor.constraint(greaterThanOrEqualToConstant: PaddingDefaultVerticalSpacing).isActive = true
middleView.topAnchor.constraint(equalTo: topView.bottomAnchor, constant: spaceAbove).isActive = true
bottomSpacer.topAnchor.constraint(equalTo: middleView.bottomAnchor).isActive = true
bottomView.topAnchor.constraint(equalTo: bottomSpacer.bottomAnchor).isActive = true
} else if let spaceBelow = spaceBelow {
// Space below is set, space above is free.
let topSpacer = MVMCoreUICommonViewsUtility.commonView()
contentView.addSubview(topSpacer)
topSpacer.leftAnchor.constraint(equalTo: contentView.leftAnchor).isActive = true
contentView.rightAnchor.constraint(equalTo: topSpacer.rightAnchor).isActive = true
topSpacer.heightAnchor.constraint(greaterThanOrEqualToConstant: PaddingDefaultVerticalSpacing).isActive = true
topSpacer.topAnchor.constraint(equalTo: topView.bottomAnchor).isActive = true
middleView.topAnchor.constraint(equalTo: topSpacer.bottomAnchor).isActive = true
bottomView.topAnchor.constraint(equalTo: middleView.bottomAnchor, constant: spaceBelow).isActive = true
} else {
// No set space above or below, make the spacers the same height with a default minimum.
let topSpacer = MVMCoreUICommonViewsUtility.commonView()
let bottomSpacer = MVMCoreUICommonViewsUtility.commonView()
contentView.addSubview(topSpacer)
contentView.addSubview(bottomSpacer)
topSpacer.leftAnchor.constraint(equalTo: contentView.leftAnchor).isActive = true
contentView.rightAnchor.constraint(equalTo: topSpacer.rightAnchor).isActive = true
bottomSpacer.leftAnchor.constraint(equalTo: contentView.leftAnchor).isActive = true
contentView.rightAnchor.constraint(equalTo: bottomSpacer.rightAnchor).isActive = true
topSpacer.heightAnchor.constraint(equalTo: bottomSpacer.heightAnchor).isActive = true
topSpacer.heightAnchor.constraint(greaterThanOrEqualToConstant: PaddingDefaultVerticalSpacing).isActive = true
topSpacer.topAnchor.constraint(equalTo: topView.bottomAnchor).isActive = true
middleView.topAnchor.constraint(equalTo: topSpacer.bottomAnchor).isActive = true
bottomSpacer.topAnchor.constraint(equalTo: middleView.bottomAnchor).isActive = true
bottomView.topAnchor.constraint(equalTo: bottomSpacer.bottomAnchor).isActive = true
}
}
}
func addViewInsideOfScrollViewBottom(_ view: UIView) {
guard let contentView = contentView else {
return
}
contentView.addSubview(view);
contentView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
contentView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
view.leftAnchor.constraint(equalTo: contentView.leftAnchor).isActive = true
}
func addViewOutsideOfScrollViewBottom(_ view: UIView) {
self.view?.addSubview(view)
if let scrollView = scrollView, let parentView = self.view {
view.topAnchor.constraint(equalTo: scrollView.bottomAnchor).isActive = true
view.leftAnchor.constraint(equalTo: parentView.leftAnchor).isActive = true
parentView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
if #available(iOS 11.0, *) {
parentView.safeAreaLayoutGuide.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
if let safeAreaView = MVMCoreUICommonViewsUtility.getAndSetupSafeAreaView(on: parentView) {
safeAreaView.backgroundColor = bottomView?.backgroundColor
self.safeAreaView = safeAreaView
}
} else {
parentView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
}
}
}
}
//MARK:-Animation
extension ThreeLayerViewController {
public override func setupIntroAnimations() {
if let topView = topView, topView.subviews.count > 0 {
introAnimationManager?.addAnimation(animation: MVMAnimations.fadeUpAnimation(view: topView))
}
if let middleView = middleView, middleView.subviews.count > 0 {
introAnimationManager?.addAnimation(animation: MVMAnimations.fadeUpAnimation(view: middleView))
}
if let bottomView = bottomView, bottomView.subviews.count > 0 {
introAnimationManager?.addAnimation(animation: MVMAnimations.fadeUpAnimation(view: bottomView))
}
}
}

View File

@ -145,7 +145,7 @@
}
- (void)setHeadlineAndMessage {
[self.topLabelsView setWithJSON:[self mapForTopLabels]];
[self.topLabelsView setHeadlineString:[[self mapForTopLabels] stringForKey:KeyTitle] messageString:[[self mapForTopLabels] stringForKey:KeyMessage]];
}
- (void)updateViewConstraints {

View File

@ -7,22 +7,70 @@
//
// 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/ViewConstrainingView.h>
#import <MVMCoreUI/TopLabelsView.h>
@class LabelView;
@interface TopLabelsAndBottomButtonsViewController : MVMCoreUIThreeLayerViewController
@class LabelView;
@class PrimaryButton;
@interface TopLabelsAndBottomButtonsViewController : StackableViewController
@property (nullable, weak, nonatomic) TopLabelsView *topLabelsView;
@property (nullable, weak, nonatomic) PrimaryButton *primaryButton;
@property (nullable, weak, nonatomic) PrimaryButton *secondaryButton;
@property (nullable, weak, nonatomic, readonly) UIView *bottomView;
@property (nullable, weak, nonatomic, readonly) UIView *topView;
@property (nullable, weak, nonatomic) UIView *viewInScroll;
@property (nullable, weak, nonatomic) UIView *viewOutOfScroll;
@property (nullable, strong, nonatomic) UIView *safeAreaView;
// 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.
@property (nullable, weak, nonatomic) UIView *topBetweenEdgeView;
@property (nullable, weak, nonatomic) UIView *bottomBetweenEdgeView;
// 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;
//*********
// If both are subclassed to return a value, then the buttons will not be pinned towards the bottom.
// If anything is returned, the class will fill in the space between the top labels and views with the passed in value.
- (nullable NSNumber *)spaceAboveBetweenView;
// If anything is returned, the class will fill in the space between the views and bottom buttons with the passed in value.
- (nullable NSNumber *)spaceBelowBetweenView;
// 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;
// default button map will automatically get from response, you can also overide this to have your own button map
- (nullable NSDictionary *)secondaryButtonMap;
- (nullable NSDictionary *)primaryButtonMap;
// Should not sub class it, for most cases, the headline and message will be in page map, but who knows how server wants to send them in certain pages
- (nullable NSDictionary *)mapForTopLabels;
// Use these if you want to replace the top labels or bottom button views with your own views.
- (nullable UIView *)useCustomViewInsteadOfLabels;
- (nullable UIView *)useCustomViewInsteadOfButtons;
// Can override if the buttons should be outside of the scroll or not. Default is no.
- (BOOL)bottomViewOutsideOfScroll;
// Build above the button view
- (nullable UIView *)buttonsAccessoryView;
@end

View File

@ -14,8 +14,6 @@
#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>
@ -25,6 +23,19 @@
@interface TopLabelsAndBottomButtonsViewController ()
@property (nullable, strong, nonatomic) NSLayoutConstraint *heightConstraint;
@property (nullable, weak, nonatomic) UIView *topView;
@property (nullable, weak, nonatomic) UIView *bottomView;
@property (nonatomic) BOOL customBottemView;
@property (nullable, weak, nonatomic) NSArray *middleViews;
@property (nullable, weak, nonatomic) UIView *betweenView;
@property (nullable, weak, nonatomic) ViewConstrainingView *bottomAccessoryView;
// Adds the button view to the screen. Out of the scroll or in.
- (void)addViewOutsideOfScrollView:(UIView *)bottomView;
- (void)addViewToContentView:(UIView *)bottomView;
@end
@implementation TopLabelsAndBottomButtonsViewController
@ -35,33 +46,31 @@
}
- (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];
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];
}
}
}
- (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 {
- (void)updateTopLabelsBottomButtonsPadding {
if (self.topLabelsView) {
UIEdgeInsets paddingForTopLabels = [self paddingForTopLabels];
self.topLabelsView.topLabelConstraint.constant = paddingForTopLabels.top;
@ -69,10 +78,8 @@
[self.topLabelsView setLeftConstant:paddingForTopLabels.left];
[self.topLabelsView setRightConstant:paddingForTopLabels.right];
}
}
- (void)updateBottomButtonsPadding:(CGFloat)size {
if (!self.customBottomView) {
if (!self.customBottemView) {
PrimaryButtonView *buttonView = (PrimaryButtonView *)self.bottomView;
if (self.secondaryButton || self.primaryButton) {
UIEdgeInsets paddingForBottomButtons = [self paddingForBottomButtons];
@ -89,4 +96,352 @@
}
}
- (void)newDataBuildScreen {
[super newDataBuildScreen];
// Removes the bottom view out of scroll if it is there.
[self.viewOutOfScroll removeFromSuperview];
[StackableViewController removeUIViews:[self.contentView subviews]];
// Checks if we are using a different object than top labels.
UIView *topView = [self useCustomViewInsteadOfLabels];
self.topView = topView;
if (!topView) {
// Sets up the labels toward the top of the screen.
TopLabelsView *topLabelsView = [[TopLabelsView alloc] initWithFrame:CGRectZero];
topLabelsView.separatorView.hidden = NO;
self.topLabelsView = topLabelsView;
topView = topLabelsView;
self.topView = topView;
}
[self.contentView addSubview:topView];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[topView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topView)]];
self.topConstraintForTopView = [NSLayoutConstraint constraintWithItem:topView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
self.topConstraintForTopView.active = YES;
// Checks if we are using a different object than the bottom buttons.
UIView *bottomView = [self useCustomViewInsteadOfButtons];
self.customBottemView = (bottomView != nil);
if (!self.customBottemView) {
// Sets up the buttons/button.
NSDictionary *primaryButtonDictionary = [self primaryButtonMap];
NSDictionary *secondaryButtonDictionary = [self secondaryButtonMap];
PrimaryButtonView *buttonView = [[PrimaryButtonView alloc] initWithPrimaryButtonMap:primaryButtonDictionary secondaryButtonMap:secondaryButtonDictionary actionDelegate:self additionalData:nil buttonDelegate:self];
self.secondaryButton = buttonView.secondaryButton;
self.primaryButton = buttonView.primaryButton;
bottomView = buttonView;
self.bottomView = bottomView;
} else {
self.bottomView = bottomView;
}
[self updateTopLabelsBottomButtonsPadding];
// Adds the bottom view outside the scroll if directed.
[self.safeAreaView removeFromSuperview];
if ([self bottomViewOutsideOfScroll]) {
if (!self.customBottemView) {
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];
}
// Adds either the bottom view or a blank view inside the scroll.
self.viewInScroll = bottomView;
[self addViewToContentView:bottomView];
// Allows addition of any custom ui before custom center view.
[self buildInAdditionalViewsBeforeCenteredContent];
// Positions the views in between the labels and buttons.
UIView *viewBetween = nil;
NSArray *views = [self buildViewsBetweenLabelsAndButtons];
self.middleViews = views;
if (views.count > 0) {
viewBetween = [MVMCoreUICommonViewsUtility commonView];
[self generateFormView:viewBetween withUIArrayForConstrainingViews:views];
[self.contentView addSubview:viewBetween];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[viewBetween]-0@900-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(viewBetween)]];
[viewBetween setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
}
self.betweenView = viewBetween;
// This whole section is for handling vertical spacing.
//-------------------------------------------------------------
UIView *topBetweenEdgeView = topView;
if (self.topBetweenEdgeView) {
topBetweenEdgeView = self.topBetweenEdgeView;
}
UIView *bottomBetweenEdgeView = bottomView;
if (self.bottomBetweenEdgeView) {
bottomBetweenEdgeView = self.bottomBetweenEdgeView;
}
// Sets the height so when there is not enough content, the bottom buttons will stay pinned. But if there is too much content, the constraint has low priority so the screen will scroll. Only made active in certain conditions.
NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintWithItem:self.contentView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.scrollView attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];
heightConstraint.priority = UILayoutPriorityDefaultLow;
self.heightConstraint = heightConstraint;
if (viewBetween) {
// These spacer views are what causes the buttons to be pinned to the bottom.
NSNumber *spaceAbove = [self spaceAboveBetweenView];
NSNumber *spaceBelow = [self spaceBelowBetweenView];
if (spaceAbove && spaceBelow) {
// Both top and bottom space set, buttons not pinned to bottom.
NSDictionary *verticalMetrics = @{@"top":spaceAbove,@"bottom":spaceBelow};
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topBetweenEdgeView]-top-[viewBetween]-bottom-[bottomBetweenEdgeView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:verticalMetrics views:NSDictionaryOfVariableBindings(topBetweenEdgeView,viewBetween,bottomBetweenEdgeView)]];
} else {
// Needs the height constraint
heightConstraint.active = YES;
if (!spaceAbove && !spaceBelow) {
// No set space above or below, make the spacers the same height with a default minimum.
UIView *topSpacer = [MVMCoreUICommonViewsUtility commonView];
UIView *bottomSpacer = [MVMCoreUICommonViewsUtility commonView];
[self.contentView addSubview:topSpacer];
[self.contentView addSubview:bottomSpacer];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[topSpacer]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topSpacer)]];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[bottomSpacer]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(bottomSpacer)]];
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;
NSDictionary *verticalMetrics = @{@"top":spaceAbove};
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topBetweenEdgeView]-top-[viewBetween]-0-[bottomSpacer]-0-[bottomBetweenEdgeView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:verticalMetrics views:NSDictionaryOfVariableBindings(topBetweenEdgeView,viewBetween,bottomSpacer,bottomBetweenEdgeView)]];
} else if (spaceBelow) {
// Space below is set, space above is free.
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;
NSDictionary *verticalMetrics = @{@"bottom":spaceBelow};
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topBetweenEdgeView]-0-[topSpacer]-0-[viewBetween]-bottom-[bottomBetweenEdgeView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:verticalMetrics views:NSDictionaryOfVariableBindings(topBetweenEdgeView,topSpacer,viewBetween,bottomBetweenEdgeView)]];
}
}
} else {
// No views in between. Just messages and buttons
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;
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topBetweenEdgeView]-0-[spacer]-0-[bottomBetweenEdgeView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topBetweenEdgeView,spacer,bottomBetweenEdgeView)]];
}
if (self.topLabelsView) {
[self.topLabelsView setHeadlineString:[[self mapForTopLabels] stringForKey:KeyTitle] messageString:[[self mapForTopLabels] stringForKey:KeyMessage]];
}
}
- (void)updateViewConstraints {
[super updateViewConstraints];
// Updates for ios 11
if (@available(iOS 11.0, *)) {
if (self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic) {
self.heightConstraint.constant = -self.scrollView.adjustedContentInset.top - self.scrollView.adjustedContentInset.bottom;
} else {
self.heightConstraint.constant = -self.scrollView.contentInset.top - self.scrollView.contentInset.bottom;
}
} else {
self.heightConstraint.constant = -self.scrollView.contentInset.top - self.scrollView.contentInset.bottom;
}
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object {
CGFloat horizontal = [MFStyler defaultHorizontalPaddingForApplicationWidth];
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;
// Buttons will be at the bottom of the content view.
[self.contentView addSubview:bottomView];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[bottomView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(bottomView)]];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[bottomView]-0@900-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(bottomView)]];
}
- (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)]];
[self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:bottomView.bottomAnchor].active = YES;
UIView *safeAreaView = [MVMCoreUICommonViewsUtility getAndSetupSafeAreaViewOnView:self.view];
safeAreaView.backgroundColor = bottomView.backgroundColor;
self.safeAreaView = safeAreaView;
} else {
// Fallback on earlier versions
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[scrollview]-0-[bottomView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(scrollview,bottomView)]];
}
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[bottomView]-0@900-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(bottomView)]];
}
#pragma mark - Can Subclass These
- (nullable UIView *)buttonsAccessoryView {
return nil;
}
- (void)buildInAdditionalViewsBeforeCenteredContent {
UIView *accessoryView = [self buttonsAccessoryView];
if (accessoryView) {
accessoryView.translatesAutoresizingMaskIntoConstraints = NO;
ViewConstrainingView *constrainingView = [ViewConstrainingView viewConstrainingView:accessoryView];
constrainingView.updateViewHorizontalDefaults = YES;
[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];
[NSLayoutConstraint constraintPinFirstView:constrainingView toSecondView:self.viewInScroll
withConstant:0 directionVertical:YES];
} else {
self.bottomAccessoryView = nil;
}
}
- (nullable NSArray <UIView *>*)buildViewsBetweenLabelsAndButtons {
return nil;
}
- (nullable NSNumber *)spaceAboveBetweenView {
return nil;
}
- (nullable NSNumber *)spaceBelowBetweenView {
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 *buttonMap = [self.loadObject.pageJSON dict:KeyButtonMap];
return [buttonMap dict:KeyPrimaryButton];
}
- (NSDictionary*)secondaryButtonMap {
NSDictionary *buttonMap = [self.loadObject.pageJSON dict:KeyButtonMap];
return [buttonMap dict:KeySecondaryButton];
}
- (nullable NSDictionary *)mapForTopLabels {
return self.loadObject.pageJSON;
}
- (nullable UIView *)useCustomViewInsteadOfLabels {
return nil;
}
- (nullable UIView *)useCustomViewInsteadOfButtons {
return nil;
}
- (BOOL)bottomViewOutsideOfScroll {
return NO;
}
#pragma mark - Animations
-(void)setupIntroAnimations {
if (self.topView.subviews) {
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topView]];
}
if (self.topBetweenEdgeView.subviews.count) {
[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) {
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.bottomBetweenEdgeView]];
}
if (self.bottomView.subviews) {
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.bottomView]];
}
}
@end

View File

@ -50,7 +50,6 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
#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>
@ -112,4 +111,3 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
#import <MVMCoreUI/MVMCoreUIMoleculeViewProtocol.h>
#pragma mark - Templates
#import <MVMCoreUI/MVMCoreUILargeHeaderSingleLabelTemplate.h>

View File

@ -86,7 +86,7 @@ public class MVMCoreUIHeaderView: ViewConstrainingView, MVMCoreUIMoleculeViewPro
separatorView?.rightPin?.constant = constant
}
public func setWithJSON(_ json: [AnyHashable : Any]?) {
public func setWithJSON(_ json: [AnyHashable : Any]?, delegate: NSObject?) {
headlineLabel.text = json?.optionalStringForKey(KeyTitle)
messageLabel.text = json?.optionalStringForKey(KeyMessage)
separatorView?.isHidden = !(json?.boolForKey("showSeparator") ?? false)

View File

@ -9,10 +9,17 @@
import UIKit
public class MVMCoreUIMoleculeStackView: MFView, MVMCoreUIMoleculeViewProtocol {
var spacingBlock: ((Any) -> UIEdgeInsets)?
var moleculesArray: [UIView]?
init(withJSON json: [AnyHashable : Any]?) {
init(withJSON json: [AnyHashable : Any]?, delegate: NSObject?) {
super.init(frame: CGRect.zero)
setWithJSON(json)
setWithJSON(json, delegate: delegate)
}
convenience init(withJSON json: [AnyHashable : Any]?, delegate: NSObject?, spacingBlock: ((Any) -> UIEdgeInsets)?) {
self.init(withJSON: json, delegate: delegate)
self.spacingBlock = spacingBlock
}
required init?(coder aDecoder: NSCoder) {
@ -36,7 +43,7 @@ public class MVMCoreUIMoleculeStackView: MFView, MVMCoreUIMoleculeViewProtocol {
}
}
public func setWithJSON(_ json: [AnyHashable : Any]?) {
public func setWithJSON(_ json: [AnyHashable : Any]?, delegate: NSObject?) {
guard let molecules = json?.arrayForKey("molecules") as? [[String: Any]] else {
return
}
@ -45,7 +52,7 @@ public class MVMCoreUIMoleculeStackView: MFView, MVMCoreUIMoleculeViewProtocol {
var moleculesArray = [] as [UIView]
for moleculeJSON in molecules {
if let name = moleculeJSON.optionalStringForKey("moleculeName"), let molecule = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeForName(name) {
molecule.setWithJSON(moleculeJSON)
molecule.setWithJSON(moleculeJSON, delegate: delegate)
moleculesArray.append(molecule)
}
}
@ -54,11 +61,15 @@ public class MVMCoreUIMoleculeStackView: MFView, MVMCoreUIMoleculeViewProtocol {
return
}
MVMCoreUIStackableViewController.populateView(self, withUIArray: moleculesArray) { (object) -> UIEdgeInsets in
if object as AnyObject? === moleculesArray.first {
return UIEdgeInsets.zero
} else {
return UIEdgeInsets.init(top: PaddingTwo, left: 0, bottom: 0, right: 0)
if let spacingBlock = spacingBlock {
MVMCoreUIStackableViewController.populateView(self, withUIArray: moleculesArray, withSpacingBlock: spacingBlock)
} else {
MVMCoreUIStackableViewController.populateView(self, withUIArray: moleculesArray) { (object) -> UIEdgeInsets in
if object as AnyObject? === moleculesArray.first {
return UIEdgeInsets.zero
} else {
return UIEdgeInsets.init(top: PaddingTwo, left: 0, bottom: 0, right: 0)
}
}
}
}

View File

@ -11,7 +11,7 @@
@protocol MVMCoreUIMoleculeViewProtocol <NSObject>
// Sets up the ui based on the json
- (void)setWithJSON:(nullable NSDictionary *)json;
- (void)setWithJSON:(nullable NSDictionary *)json delegate:(nullable NSObject *)delegate;
@end

View File

@ -50,4 +50,6 @@
- (void)showBothPrimaryButtons;
- (void)hideBothPrimaryButtons;
- (void)removeSubviews;
@end

View File

@ -0,0 +1,22 @@
//
// PrimaryButtonViewMoleculeProtocolExtension.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 2/12/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import Foundation
extension PrimaryButtonView: MVMCoreUIMoleculeViewProtocol {
public func setWithJSON(_ json: [AnyHashable : Any]?, delegate: NSObject?) {
let firstButtonMap = json?.optionalDictionaryForKey("FirstButton")
let secondButtonMap = json?.optionalDictionaryForKey("SecondButton")
if let backgroundColor = json?.optionalStringForKey("backgroundColor") {
self.backgroundColor = UIColor.mfGet(forHex: backgroundColor)
}
let actionDelegate = delegate as? MVMCoreActionDelegateProtocol & NSObjectProtocol
let buttonDelegate = delegate as? ButtonDelegateProtocol
setup(withPrimaryButtonMap: firstButtonMap, secondaryButtonMap: secondButtonMap, actionDelegate: actionDelegate, additionalData: nil, buttonDelegate: buttonDelegate)
}
}

View File

@ -19,6 +19,6 @@
// Returns the molecule for the given name.
- (nullable UIView <MVMCoreUIMoleculeViewProtocol>*)getMoleculeForName:(nonnull NSString *)name;
- (nullable UIView <MVMCoreUIMoleculeViewProtocol>*)getMoleculeForJSON:(nonnull NSDictionary *)json;
- (nullable UIView <MVMCoreUIMoleculeViewProtocol>*)getMoleculeForJSON:(nonnull NSDictionary *)json delegate:(nullable NSObject *)delegate;
@end

View File

@ -23,6 +23,7 @@
mapping = [@{
@"StandardHeader": MVMCoreUIHeaderView.class,
@"MoleculeStack": MVMCoreUIMoleculeStackView.class,
@"TwoButtonView": PrimaryButtonView.class
} mutableCopy];
});
return mapping;
@ -41,13 +42,13 @@
return nil;
}
- (nullable UIView <MVMCoreUIMoleculeViewProtocol>*)getMoleculeForJSON:(nonnull NSDictionary *)json {
- (nullable UIView <MVMCoreUIMoleculeViewProtocol>*)getMoleculeForJSON:(nonnull NSDictionary *)json delegate:(nullable NSObject *)delegate {
NSString *moleculeName = [json string:@"moleculeName"];
if (!moleculeName) {
return nil;
}
UIView <MVMCoreUIMoleculeViewProtocol>*molecule = [self getMoleculeForName:moleculeName];
[molecule setWithJSON:json];
[molecule setWithJSON:json delegate:delegate];
return molecule;
}

View File

@ -8,7 +8,6 @@
#import "MVMCoreUIViewControllerMappingObject.h"
#import <MVMCore/MVMCoreViewControllerProgrammaticMappingObject.h>
#import "MVMCoreUILargeHeaderSingleLabelTemplate.h"
#import <MVMCoreUI/MVMCoreUI-Swift.h>
@implementation MVMCoreUIViewControllerMappingObject
@ -20,10 +19,10 @@
static NSMutableDictionary *viewControllerMapping;
dispatch_once(&onceToken, ^{
viewControllerMapping = [@{
@"LargeHeaderSingleLabel": [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MVMCoreUILargeHeaderSingleLabelTemplate class]],
@"LegacyLargeHeaderSingleLabel": [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[LegacyLargeHeaderSingleLabelTemplate class]],
@"TextFieldListForm" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MVMCoreUITextFieldListFormViewController class]],
@"MoleculeStack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MVMCoreUIMoleculeStackTemplate class]],
@"CenterMoleculeStack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MVMCoreUIMoleculeStackCenteredTemplate class]]
@"MoleculeStack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeStackTemplate class]],
@"CenterMoleculeStack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeStackCenteredTemplate class]]
} mutableCopy];
});
return viewControllerMapping;

View File

@ -0,0 +1,61 @@
//
// LegacyLargeHeaderSingleLabelTemplate.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 2/13/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
public class LegacyLargeHeaderSingleLabelTemplate: TopLabelsAndBottomButtonsViewController {
// A label that can go below the top labels. Can be a normal label or one with internal buttons.
var labelViewUnderTopLabels: LabelView?
var labelUnderTopLabelsWithInternalButton: LabelWithInternalButton?
public override func newDataBuildScreen() {
super.newDataBuildScreen()
topLabelsView?.headlineLabel?.setFontH1(true)
topLabelsView?.separatorView?.hide()
}
public override func buildViewsBetweenLabelsAndButtons() -> [UIView]? {
var views = [UIView]()
if let labelActionMap = actionMapForLabelUnderTopLabelsWithInternalButton(), let labelUnderTopLabelsWithInternalButton = LabelWithInternalButton(actionMap: labelActionMap, additionalData: nil, actionDelegate: self) {
labelUnderTopLabelsWithInternalButton.translatesAutoresizingMaskIntoConstraints = false
labelUnderTopLabelsWithInternalButton.setAlignment(NSTextAlignment.left)
views.append(labelUnderTopLabelsWithInternalButton)
self.labelUnderTopLabelsWithInternalButton = labelUnderTopLabelsWithInternalButton
} else if let labelString = stringForLabelUnderTopLabels() {
let labelView = LabelView(frame: CGRect.zero)
labelView.translatesAutoresizingMaskIntoConstraints = false
labelView.alignLeft()
labelView.label?.styleB2(true)
labelView.label?.text = labelString
labelView.label?.setContentHuggingPriority(UILayoutPriority.required, for: NSLayoutConstraint.Axis.vertical)
views.append(labelView)
self.labelViewUnderTopLabels = labelView
}
return views;
}
public func actionMapForLabelUnderTopLabelsWithInternalButton() -> [AnyHashable : Any]? {
return loadObject?.pageJSON?.optionalDictionaryWithChainOfKeysOrIndexes([KeyButtonMap,"Link"])
}
public func stringForLabelUnderTopLabels() -> String? {
return loadObject?.pageJSON?.optionalStringForKey("description")
}
public override func spaceAboveBetweenView() -> NSNumber? {
return 0 as NSNumber
}
public override func paddingForTopLabels() -> UIEdgeInsets {
var padding = super.paddingForTopLabels()
padding.bottom = PaddingTwo
return padding
}
}

View File

@ -1,26 +0,0 @@
//
// MVMCoreUILargeHeaderSingleLabelTemplate.h
// MVMCoreUI
//
// Created by Scott Pfeil on 1/8/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MVMCoreUI/MVMCoreUIThreeLayerViewController.h>
@class LabelView;
@class LabelWithInternalButton;
@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;
@property (nullable, weak, nonatomic) LabelWithInternalButton *labelUnderTopLabelsWithInternalButton;
// Override to specifiy the label under top label. Default uses the value for key "description" in the page json.
- (nullable NSString *)stringForLabelUnderTopLabels;
// Override to specifiy the label under top label with internal button. Default uses the value for key "Link" in the "ButtonMap" of the page json.
- (nullable NSDictionary *)actionMapForLabelUnderTopLabelsWithInternalButton;
@end

View File

@ -1,80 +0,0 @@
//
// MVMCoreUILargeHeaderSingleLabelTemplate.m
// MVMCoreUI
//
// Created by Scott Pfeil on 1/8/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
#import "MVMCoreUILargeHeaderSingleLabelTemplate.h"
#import "LabelView.h"
#import "LabelWithInternalButton.h"
#import "UIColor+MFConvenience.h"
#import "TopLabelsView.h"
@interface MVMCoreUILargeHeaderSingleLabelTemplate ()
@end
@implementation MVMCoreUILargeHeaderSingleLabelTemplate
- (void)newDataBuildScreen {
[super newDataBuildScreen];
[self.topLabelsView.headlineLabel setFontH1:YES];
[self.topLabelsView.separatorView hide];
}
- (nullable NSArray <UIView *>*)buildViewsBetweenLabelsAndButtons {
NSDictionary *labelActionMap = [self actionMapForLabelUnderTopLabelsWithInternalButton];
NSString *labelString = [self stringForLabelUnderTopLabels];
NSMutableArray *views = [[NSMutableArray alloc] init];
if (labelActionMap.count > 0) {
// Use label with internal button.
LabelWithInternalButton *labelWithInternalButton = [[LabelWithInternalButton alloc] initWithActionMap:labelActionMap additionalData:nil actionDelegate:self buttonDelegate:self];
labelWithInternalButton.translatesAutoresizingMaskIntoConstraints = NO;
[labelWithInternalButton setAlignment:NSTextAlignmentLeft];
self.labelUnderTopLabelsWithInternalButton = labelWithInternalButton;
[views addObject:labelWithInternalButton];
} else if (labelString.length > 0){
// Use regular label
LabelView *labelView = [[LabelView alloc] init];
labelView.translatesAutoresizingMaskIntoConstraints = NO;
[labelView alignLeft];
[labelView.label styleB2:YES];
labelView.label.text = labelString;
[labelView.label setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
self.labelViewUnderTopLabels = labelView;
[views addObject:labelView];
}
return views;
}
- (nullable NSString *)stringForLabelUnderTopLabels {
return [self.loadObject.pageJSON stringForKey:@"description"];
}
- (nullable NSDictionary *)actionMapForLabelUnderTopLabelsWithInternalButton {
return [self.loadObject.pageJSON dictWithChainOfKeysOrIndexes:@[KeyButtonMap,@"Link"]];
}
- (NSNumber *)spaceAboveBetweenView {
return @(0);
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)updateTopLabelsPadding:(CGFloat)size {
[super updateTopLabelsPadding:size];
self.topLabelsView.bottomLabelConstraint.constant = PaddingTwo;
}
@end

View File

@ -1,44 +0,0 @@
//
// MVMCoreUIMoleculeStackCenteredTemplate.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 2/12/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
public class MVMCoreUIMoleculeStackCenteredTemplate: MVMCoreUIThreeLayerViewController {
override public func mapForTopLabels() -> [AnyHashable : Any]? {
return nil
}
public override func primaryButtonMap() -> [AnyHashable : Any]? {
return nil
}
public override func secondaryButtonMap() -> [AnyHashable : Any]? {
return nil
}
override public func buildViewsBetweenLabelsAndButtons() -> [UIView]? {
let molecule = loadObject?.pageJSON?.optionalDictionaryForKey("MoleculeStack")
let moleculeStack = MVMCoreUIMoleculeStackView(withJSON: molecule)
return [moleculeStack]
}
public override func useCustomViewInsteadOfLabels() -> UIView? {
guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("Header"), let molecule = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeForJSON(moleculeJSON) else {
return nil
}
return molecule
}
override public func useCustomViewInsteadOfButtons() -> UIView? {
guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("Footer"), let molecule = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeForJSON(moleculeJSON) else {
return nil
}
return molecule
}
}

View File

@ -1,42 +0,0 @@
//
// MVMCoreUIMoleculeStackTemplate.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 2/11/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
public class MVMCoreUIMoleculeStackTemplate: MVMCoreUIThreeLayerViewController {
override public func spaceAboveBetweenView() -> NSNumber? {
return 0
}
override public func mapForTopLabels() -> [AnyHashable : Any]? {
return nil
}
public override func primaryButtonMap() -> [AnyHashable : Any]? {
return nil
}
public override func secondaryButtonMap() -> [AnyHashable : Any]? {
return nil
}
public override func useCustomViewInsteadOfLabels() -> UIView? {
guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("MoleculeStack") else {
return nil
}
return MVMCoreUIMoleculeStackView(withJSON: moleculeJSON)
}
override public func useCustomViewInsteadOfButtons() -> UIView? {
guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("Footer"), let molecule = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeForJSON(moleculeJSON) else {
return nil
}
return molecule
}
}

View File

@ -0,0 +1,32 @@
//
// MoleculeStackCenteredTemplate.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 2/12/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
public class MoleculeStackCenteredTemplate: ThreeLayerViewController {
public override func viewForMiddle() -> UIView? {
let molecule = loadObject?.pageJSON?.optionalDictionaryForKey("MoleculeStack")
let moleculeStack = MVMCoreUIMoleculeStackView(withJSON: molecule, delegate: self)
return moleculeStack
}
public override func viewForTop() -> UIView? {
guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("Header"), let molecule = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeForJSON(moleculeJSON, delegate: self) else {
return nil
}
return molecule
}
override public func viewForBottom() -> UIView? {
guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("Footer"), let molecule = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeForJSON(moleculeJSON, delegate: self) else {
return nil
}
return molecule
}
}

View File

@ -0,0 +1,38 @@
//
// MoleculeStackTemplate.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 2/11/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
public class MoleculeStackTemplate: ThreeLayerViewController {
public override func spaceBetweenMiddleAndBottom() -> CGFloat? {
return PaddingTwo
}
public override func viewForTop() -> UIView? {
guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("Header"), let molecule = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeForJSON(moleculeJSON, delegate: self) else {
return nil
}
return molecule
}
public override func viewForMiddle() -> UIView? {
guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("MoleculeStack") else {
return nil
}
return MVMCoreUIMoleculeStackView(withJSON: moleculeJSON, delegate: self)
}
override public func viewForBottom() -> UIView? {
guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("Footer"), let molecule = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeForJSON(moleculeJSON, delegate: self) else {
return nil
}
return molecule
}
}