fix to class check for nil

convenience functions
init functions
This commit is contained in:
Pfeil, Scott Robert 2019-01-25 16:12:27 -05:00
parent d0f0736360
commit 21707d5cd3
8 changed files with 103 additions and 20 deletions

View File

@ -7,6 +7,8 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* 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 */; }; 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, ); }; }; 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 */; }; D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770EE21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m */; };
@ -142,6 +144,8 @@
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUINavigationControllerViewController.h; sourceTree = "<group>"; };
D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUINavigationControllerViewController.m; sourceTree = "<group>"; };
D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsView.m; sourceTree = "<group>"; }; D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsView.m; sourceTree = "<group>"; };
D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopLabelsView.h; sourceTree = "<group>"; }; D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopLabelsView.h; sourceTree = "<group>"; };
D29770EE21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsAndBottomButtonsTableViewController.m; sourceTree = "<group>"; }; D29770EE21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsAndBottomButtonsTableViewController.m; sourceTree = "<group>"; };
@ -409,6 +413,8 @@
children = ( children = (
D29DF2B721E7BE79003B2FB9 /* TabBarController */, D29DF2B721E7BE79003B2FB9 /* TabBarController */,
D29DF2B621E7BE66003B2FB9 /* SplitViewController */, D29DF2B621E7BE66003B2FB9 /* SplitViewController */,
D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h */,
D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m */,
); );
path = Containers; path = Containers;
sourceTree = "<group>"; sourceTree = "<group>";
@ -644,6 +650,7 @@
D29DF26421E6A9D9003B2FB9 /* MFTransparentGIFView.h in Headers */, D29DF26421E6A9D9003B2FB9 /* MFTransparentGIFView.h in Headers */,
D29DF27921E7A533003B2FB9 /* MVMCoreUISession.h in Headers */, D29DF27921E7A533003B2FB9 /* MVMCoreUISession.h in Headers */,
D29DF25C21E6A2B6003B2FB9 /* DashLine.h in Headers */, D29DF25C21E6A2B6003B2FB9 /* DashLine.h in Headers */,
D206997721FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h in Headers */,
D29DF29D21E7AE38003B2FB9 /* MFStyler.h in Headers */, D29DF29D21E7AE38003B2FB9 /* MFStyler.h in Headers */,
D29DF2B021E7B3A4003B2FB9 /* MFTextView.h in Headers */, D29DF2B021E7B3A4003B2FB9 /* MFTextView.h in Headers */,
D29DF2A921E7B2F9003B2FB9 /* MVMCoreUIConstants.h in Headers */, D29DF2A921E7B2F9003B2FB9 /* MVMCoreUIConstants.h in Headers */,
@ -816,6 +823,7 @@
D29DF2BF21E7BEA4003B2FB9 /* MVMCoreUITabBarPageControlViewController.m in Sources */, D29DF2BF21E7BEA4003B2FB9 /* MVMCoreUITabBarPageControlViewController.m in Sources */,
D29DF28321E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.m in Sources */, D29DF28321E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.m in Sources */,
D29DF28A21E7AC2B003B2FB9 /* MFLabel.m in Sources */, D29DF28A21E7AC2B003B2FB9 /* MFLabel.m in Sources */,
D206997821FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m in Sources */,
D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */, D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */,
D29DF2C921E7BFC6003B2FB9 /* MFSizeObject.m in Sources */, D29DF2C921E7BFC6003B2FB9 /* MFSizeObject.m in Sources */,
D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */, D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */,

View File

@ -35,7 +35,7 @@
#import "MVMCoreUISession.h" #import "MVMCoreUISession.h"
#import "MVMCoreUILoggingHandler.h" #import "MVMCoreUILoggingHandler.h"
#import "MVMCoreUITabBarPageControlViewController.h" #import "MVMCoreUITabBarPageControlViewController.h"
#import "MVMCoreUINavigationControllerViewController.h"
@import MVMAnimationFramework; @import MVMAnimationFramework;
@interface MFViewController () @interface MFViewController ()
@ -290,7 +290,7 @@
[[MVMCoreUISession sharedGlobal].splitViewController setNavigationIconColor:navigationBarTintColor]; [[MVMCoreUISession sharedGlobal].splitViewController setNavigationIconColor:navigationBarTintColor];
// Update separator. // Update separator.
UIView *separatorView = (UIView *)[MVMCoreUISession sharedGlobal].splitViewController.navigationBarSeparator; UIView *separatorView = (UIView *)[MVMCoreUISession sharedGlobal].navigationController.separatorView;
separatorView.hidden = ([self isKindOfClass:[MVMCoreUITabBarPageControlViewController class]] separatorView.hidden = ([self isKindOfClass:[MVMCoreUITabBarPageControlViewController class]]
|| self.manager || self.manager
|| self.loadObject.requestParameters.tabWasPressed); || self.loadObject.requestParameters.tabWasPressed);

View File

@ -0,0 +1,25 @@
//
// MVMCoreUINavigationControllerViewController.h
// MVMCoreUI
//
// Created by Scott Pfeil on 1/25/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
#import <UIKit/UIKit.h>
@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

View File

@ -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

View File

@ -13,7 +13,7 @@
#import <MVMCoreUI/MVMCoreUIPanelProtocol.h> #import <MVMCoreUI/MVMCoreUIPanelProtocol.h>
#import <MVMCoreUI/MVMCoreUIPanelButtonProtocol.h> #import <MVMCoreUI/MVMCoreUIPanelButtonProtocol.h>
@class SeparatorView; @class MVMCoreUINavigationControllerViewController;
@class MVMCoreUITopAlertView; @class MVMCoreUITopAlertView;
@class MFViewController; @class MFViewController;
@ -35,11 +35,10 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
@property (nullable, strong, nonatomic) UIBarButtonItem *backButton; @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 // Reference to the top alert view
@property (nullable, weak, nonatomic) MVMCoreUITopAlertView *topAlertView; @property (nullable, weak, nonatomic) MVMCoreUITopAlertView *topAlertView;
@property (nullable, strong, nonatomic) SeparatorView *navigationBarSeparator;
// References to the current navigation item settings. // References to the current navigation item settings.
@property (nonatomic, readonly) BOOL leftPanelIsAccessible; @property (nonatomic, readonly) BOOL leftPanelIsAccessible;
@ -49,6 +48,9 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
// Convenience getter // Convenience getter
+ (nullable instancetype)mainSplitViewController; + (nullable instancetype)mainSplitViewController;
// Returns a split controller with the mvm styling. Also sets the appropriate handlers.
+ (nullable instancetype)setup;
#pragma mark - Panel Functions #pragma mark - Panel Functions
// Sets if the left panel accessible for the view controller. Will show or hide the button. // Sets if the left panel accessible for the view controller. Will show or hide the button.

View File

@ -12,6 +12,7 @@
@import MVMCore.MVMCoreViewControllerProtocol; @import MVMCore.MVMCoreViewControllerProtocol;
@import MVMCore.MVMCoreViewManagerProtocol; @import MVMCore.MVMCoreViewManagerProtocol;
@import MVMCore.MVMCoreObject; @import MVMCore.MVMCoreObject;
@import MVMCore.MVMCoreActionUtility;
#import "MVMCoreUIUtility.h" #import "MVMCoreUIUtility.h"
#import "UIColor+MFConvenience.h" #import "UIColor+MFConvenience.h"
#import "NSLayoutConstraint+MFConvenience.h" #import "NSLayoutConstraint+MFConvenience.h"
@ -24,6 +25,7 @@
#import "MVMCoreUIConstants.h" #import "MVMCoreUIConstants.h"
#import "MVMCoreUICommonViewsUtility.h" #import "MVMCoreUICommonViewsUtility.h"
#import "MVMCoreUITopAlertView.h" #import "MVMCoreUITopAlertView.h"
#import "MVMCoreUINavigationControllerViewController.h"
@interface MVMCoreUISplitViewController () @interface MVMCoreUISplitViewController ()
@ -40,7 +42,7 @@
@property (weak, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *leftPanel; @property (weak, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *leftPanel;
@property (weak, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *rightPanel; @property (weak, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *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. // A view that covers the detail view when the master is out.
@property (weak, nonatomic) IBOutlet UIView *mainViewCoverView; @property (weak, nonatomic) IBOutlet UIView *mainViewCoverView;
@ -77,7 +79,13 @@ typedef NS_OPTIONS(NSInteger, MFExtendedDrawer) {
CGFloat const PanelAnimationDuration = 0.2; CGFloat const PanelAnimationDuration = 0.2;
+ (instancetype)mainSplitViewController { + (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 #pragma mark - Main Subclassables
@ -669,20 +677,10 @@ CGFloat const PanelAnimationDuration = 0.2;
} }
// The main view. // The main view.
UINavigationController *navigationController = [[UINavigationController alloc] init]; MVMCoreUINavigationControllerViewController *navigationController = [MVMCoreUINavigationControllerViewController setupNavigationController];
self.navigationController = navigationController; self.navigationController = navigationController;
self.automaticallyAdjustsScrollViewInsets = NO; 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; UIView *mainView = navigationController.view;
mainView.translatesAutoresizingMaskIntoConstraints = NO; mainView.translatesAutoresizingMaskIntoConstraints = NO;
[self addChildViewController:navigationController]; [self addChildViewController:navigationController];

View File

@ -54,6 +54,8 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
#import <MVMCoreUI/TopLabelsAndBottomButtonsTableViewController.h> #import <MVMCoreUI/TopLabelsAndBottomButtonsTableViewController.h>
#pragma mark - Containers #pragma mark - Containers
#import <MVMCoreUI/MVMCoreUINavigationControllerViewController.h>
#import <MVMCoreUI/MVMCoreUIPanelProtocol.h> #import <MVMCoreUI/MVMCoreUIPanelProtocol.h>
#import <MVMCoreUI/MVMCoreUIDetailViewProtocol.h> #import <MVMCoreUI/MVMCoreUIDetailViewProtocol.h>
#import <MVMCoreUI/MVMCoreUIPanelButtonProtocol.h> #import <MVMCoreUI/MVMCoreUIPanelButtonProtocol.h>

View File

@ -11,12 +11,14 @@
@class MVMCoreUITopAlertView; @class MVMCoreUITopAlertView;
@class MVMCoreUISplitViewController; @class MVMCoreUISplitViewController;
@class MFViewController; @class MFViewController;
@class MVMCoreUINavigationControllerViewController;
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface MVMCoreUISession : MVMCoreSessionObject @interface MVMCoreUISession : MVMCoreSessionObject
@property (strong, nonatomic, nullable) MVMCoreUITopAlertView *topAlertView; @property (weak, nonatomic, nullable) MVMCoreUITopAlertView *topAlertView;
@property (strong, nonatomic, nullable) MVMCoreUISplitViewController *splitViewController; @property (weak, nonatomic, nullable) MVMCoreUISplitViewController *splitViewController;
@property (weak, nonatomic, nullable) MVMCoreUINavigationControllerViewController *navigationController;
// for handscroll Animation on subclasses of MFScrollingViewController // for handscroll Animation on subclasses of MFScrollingViewController
@property (assign, nonatomic) BOOL enableHandScrollAnimation; @property (assign, nonatomic) BOOL enableHandScrollAnimation;