diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 8260a8c5..e7706a6d 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + D206997721FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D206997821FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m */; }; D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */; }; D29770C921F7C4AE00B2F0D0 /* TopLabelsView.h in Headers */ = {isa = PBXBuildFile; fileRef = D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */; settings = {ATTRIBUTES = (Public, ); }; }; D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770EE21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m */; }; @@ -142,6 +144,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUINavigationControllerViewController.h; sourceTree = ""; }; + D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUINavigationControllerViewController.m; sourceTree = ""; }; D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsView.m; sourceTree = ""; }; D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopLabelsView.h; sourceTree = ""; }; D29770EE21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsAndBottomButtonsTableViewController.m; sourceTree = ""; }; @@ -409,6 +413,8 @@ children = ( D29DF2B721E7BE79003B2FB9 /* TabBarController */, D29DF2B621E7BE66003B2FB9 /* SplitViewController */, + D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h */, + D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m */, ); path = Containers; sourceTree = ""; @@ -644,6 +650,7 @@ D29DF26421E6A9D9003B2FB9 /* MFTransparentGIFView.h in Headers */, D29DF27921E7A533003B2FB9 /* MVMCoreUISession.h in Headers */, D29DF25C21E6A2B6003B2FB9 /* DashLine.h in Headers */, + D206997721FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h in Headers */, D29DF29D21E7AE38003B2FB9 /* MFStyler.h in Headers */, D29DF2B021E7B3A4003B2FB9 /* MFTextView.h in Headers */, D29DF2A921E7B2F9003B2FB9 /* MVMCoreUIConstants.h in Headers */, @@ -816,6 +823,7 @@ D29DF2BF21E7BEA4003B2FB9 /* MVMCoreUITabBarPageControlViewController.m in Sources */, D29DF28321E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.m in Sources */, D29DF28A21E7AC2B003B2FB9 /* MFLabel.m in Sources */, + D206997821FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m in Sources */, D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */, D29DF2C921E7BFC6003B2FB9 /* MFSizeObject.m in Sources */, D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */, diff --git a/MVMCoreUI/BaseControllers/MFViewController.m b/MVMCoreUI/BaseControllers/MFViewController.m index 9ae4d2a0..383d923a 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.m +++ b/MVMCoreUI/BaseControllers/MFViewController.m @@ -35,7 +35,7 @@ #import "MVMCoreUISession.h" #import "MVMCoreUILoggingHandler.h" #import "MVMCoreUITabBarPageControlViewController.h" - +#import "MVMCoreUINavigationControllerViewController.h" @import MVMAnimationFramework; @interface MFViewController () @@ -290,7 +290,7 @@ [[MVMCoreUISession sharedGlobal].splitViewController setNavigationIconColor:navigationBarTintColor]; // Update separator. - UIView *separatorView = (UIView *)[MVMCoreUISession sharedGlobal].splitViewController.navigationBarSeparator; + UIView *separatorView = (UIView *)[MVMCoreUISession sharedGlobal].navigationController.separatorView; separatorView.hidden = ([self isKindOfClass:[MVMCoreUITabBarPageControlViewController class]] || self.manager || self.loadObject.requestParameters.tabWasPressed); diff --git a/MVMCoreUI/Containers/MVMCoreUINavigationControllerViewController.h b/MVMCoreUI/Containers/MVMCoreUINavigationControllerViewController.h new file mode 100644 index 00000000..3ec6d4c7 --- /dev/null +++ b/MVMCoreUI/Containers/MVMCoreUINavigationControllerViewController.h @@ -0,0 +1,25 @@ +// +// MVMCoreUINavigationControllerViewController.h +// MVMCoreUI +// +// Created by Scott Pfeil on 1/25/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +#import +@class SeparatorView; +NS_ASSUME_NONNULL_BEGIN + +@interface MVMCoreUINavigationControllerViewController : UINavigationController + +// Convenience getter ++ (nullable instancetype)navigationController; + +// Returns a navigation controller with the mvm styling. Also sets the navigation controller in the appropriate handlers. ++ (nullable instancetype)setupNavigationController; + +// Separator at the bottom of the navigation bar used for styling. +@property (nullable, weak, nonatomic) SeparatorView *separatorView; +@end + +NS_ASSUME_NONNULL_END diff --git a/MVMCoreUI/Containers/MVMCoreUINavigationControllerViewController.m b/MVMCoreUI/Containers/MVMCoreUINavigationControllerViewController.m new file mode 100644 index 00000000..fc3f4310 --- /dev/null +++ b/MVMCoreUI/Containers/MVMCoreUINavigationControllerViewController.m @@ -0,0 +1,46 @@ +// +// MVMCoreUINavigationControllerViewController.m +// MVMCoreUI +// +// Created by Scott Pfeil on 1/25/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +#import "MVMCoreUINavigationControllerViewController.h" +#import "UIColor+MFConvenience.h" +#import "SeparatorView.h" +#import "MFFonts.h" +#import "MFSizeObject.h" +#import "MVMCoreUISession.h" +@import MVMCore.MVMCoreActionUtility; +@import MVMCore.MVMCoreNavigationHandler; +@interface MVMCoreUINavigationControllerViewController () + +@end + +@implementation MVMCoreUINavigationControllerViewController + ++ (nullable instancetype)navigationController { + return [MVMCoreActionUtility initializerClassCheck:[MVMCoreUISession sharedGlobal].navigationController classToVerify:self]; +} + ++ (nullable instancetype)setupNavigationController { + MVMCoreUINavigationControllerViewController *navigationController = [[MVMCoreUINavigationControllerViewController alloc] init]; + [UIColor mfSetBackgroundColorForNavigationBar:[UIColor whiteColor] navigationBar:navigationController.navigationBar transparent:NO]; + [navigationController.navigationBar setShadowImage:[[UIImage alloc] init]]; + navigationController.navigationBar.translucent = NO; + navigationController.navigationBar.opaque = YES; + navigationController.navigationBar.tintColor = [UIColor blackColor]; + navigationController.separatorView = [SeparatorView separatorAddToView:navigationController.navigationBar position:SeparatorPositionBot withHorizontalPadding:0]; + [navigationController.separatorView setAsLight]; + [navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[MFFonts mfFont75Bd:[[MFSizeObject sizeObjectWithStandardSize:14 standardiPadPortraitSize:16 iPadProLandscapeSize:18] getValueBasedOnScreenSize]]}]; + + // Set standard + [MVMCoreUISession sharedGlobal].navigationController = navigationController; + [MVMCoreNavigationHandler sharedNavigationHandler].navigationController = navigationController; + [MVMCoreNavigationHandler sharedNavigationHandler].viewControllerToPresentOn = navigationController; + + return navigationController; +} + +@end diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h index 2fb3c0e6..6e59dde6 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h @@ -13,7 +13,7 @@ #import #import -@class SeparatorView; +@class MVMCoreUINavigationControllerViewController; @class MVMCoreUITopAlertView; @class MFViewController; @@ -35,11 +35,10 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { @property (nullable, strong, nonatomic) UIBarButtonItem *backButton; -@property (nullable, weak, nonatomic, readonly) UINavigationController *navigationController; +@property (nullable, weak, nonatomic, readonly) MVMCoreUINavigationControllerViewController *navigationController; // Reference to the top alert view @property (nullable, weak, nonatomic) MVMCoreUITopAlertView *topAlertView; -@property (nullable, strong, nonatomic) SeparatorView *navigationBarSeparator; // References to the current navigation item settings. @property (nonatomic, readonly) BOOL leftPanelIsAccessible; @@ -49,6 +48,9 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { // Convenience getter + (nullable instancetype)mainSplitViewController; +// Returns a split controller with the mvm styling. Also sets the appropriate handlers. ++ (nullable instancetype)setup; + #pragma mark - Panel Functions // Sets if the left panel accessible for the view controller. Will show or hide the button. diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index eadd6d57..861e13ac 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -12,6 +12,7 @@ @import MVMCore.MVMCoreViewControllerProtocol; @import MVMCore.MVMCoreViewManagerProtocol; @import MVMCore.MVMCoreObject; +@import MVMCore.MVMCoreActionUtility; #import "MVMCoreUIUtility.h" #import "UIColor+MFConvenience.h" #import "NSLayoutConstraint+MFConvenience.h" @@ -24,6 +25,7 @@ #import "MVMCoreUIConstants.h" #import "MVMCoreUICommonViewsUtility.h" #import "MVMCoreUITopAlertView.h" +#import "MVMCoreUINavigationControllerViewController.h" @interface MVMCoreUISplitViewController () @@ -40,7 +42,7 @@ @property (weak, nonatomic, readwrite) UIViewController *leftPanel; @property (weak, nonatomic, readwrite) UIViewController *rightPanel; -@property (weak, nonatomic, readwrite) UINavigationController *navigationController; +@property (weak, nonatomic, readwrite) MVMCoreUINavigationControllerViewController *navigationController; // A view that covers the detail view when the master is out. @property (weak, nonatomic) IBOutlet UIView *mainViewCoverView; @@ -77,7 +79,13 @@ typedef NS_OPTIONS(NSInteger, MFExtendedDrawer) { CGFloat const PanelAnimationDuration = 0.2; + (instancetype)mainSplitViewController { - return [MVMCoreUISession sharedGlobal].splitViewController; + return [MVMCoreActionUtility initializerClassCheck:[MVMCoreUISession sharedGlobal].splitViewController classToVerify:self]; +} + ++ (nullable instancetype)setup { + MVMCoreUISplitViewController *splitViewController = [[self alloc] init]; + [MVMCoreUISession sharedGlobal].splitViewController = splitViewController; + return splitViewController; } #pragma mark - Main Subclassables @@ -669,20 +677,10 @@ CGFloat const PanelAnimationDuration = 0.2; } // The main view. - UINavigationController *navigationController = [[UINavigationController alloc] init]; + MVMCoreUINavigationControllerViewController *navigationController = [MVMCoreUINavigationControllerViewController setupNavigationController]; self.navigationController = navigationController; self.automaticallyAdjustsScrollViewInsets = NO; - // Sets the navigation bar style - [UIColor mfSetBackgroundColorForNavigationBar:[UIColor whiteColor] navigationBar:navigationController.navigationBar transparent:NO]; - [navigationController.navigationBar setShadowImage:[[UIImage alloc] init]]; - navigationController.navigationBar.translucent = NO; - navigationController.navigationBar.opaque = YES; - navigationController.navigationBar.tintColor = [UIColor blackColor]; - self.navigationBarSeparator = [SeparatorView separatorAddToView:navigationController.navigationBar position:SeparatorPositionBot withHorizontalPadding:0]; - [self.navigationBarSeparator setAsLight]; - [navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[MFFonts mfFont75Bd:[[MFSizeObject sizeObjectWithStandardSize:14 standardiPadPortraitSize:16 iPadProLandscapeSize:18] getValueBasedOnScreenSize]]}]; - UIView *mainView = navigationController.view; mainView.translatesAutoresizingMaskIntoConstraints = NO; [self addChildViewController:navigationController]; diff --git a/MVMCoreUI/MVMCoreUI.h b/MVMCoreUI/MVMCoreUI.h index 4779ba75..6e2f0ea3 100644 --- a/MVMCoreUI/MVMCoreUI.h +++ b/MVMCoreUI/MVMCoreUI.h @@ -54,6 +54,8 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[]; #import #pragma mark - Containers +#import + #import #import #import diff --git a/MVMCoreUI/Session/MVMCoreUISession.h b/MVMCoreUI/Session/MVMCoreUISession.h index b3867ddd..4589e12e 100644 --- a/MVMCoreUI/Session/MVMCoreUISession.h +++ b/MVMCoreUI/Session/MVMCoreUISession.h @@ -11,12 +11,14 @@ @class MVMCoreUITopAlertView; @class MVMCoreUISplitViewController; @class MFViewController; +@class MVMCoreUINavigationControllerViewController; NS_ASSUME_NONNULL_BEGIN @interface MVMCoreUISession : MVMCoreSessionObject -@property (strong, nonatomic, nullable) MVMCoreUITopAlertView *topAlertView; -@property (strong, nonatomic, nullable) MVMCoreUISplitViewController *splitViewController; +@property (weak, nonatomic, nullable) MVMCoreUITopAlertView *topAlertView; +@property (weak, nonatomic, nullable) MVMCoreUISplitViewController *splitViewController; +@property (weak, nonatomic, nullable) MVMCoreUINavigationControllerViewController *navigationController; // for handscroll Animation on subclasses of MFScrollingViewController @property (assign, nonatomic) BOOL enableHandScrollAnimation;