45 lines
2.0 KiB
Swift
45 lines
2.0 KiB
Swift
//
|
|
// NavigationController.swift
|
|
// MVMCoreUI
|
|
//
|
|
// Created by Scott Pfeil on 10/24/19.
|
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
@objcMembers open class NavigationController: UINavigationController {
|
|
public var separatorView: Line?
|
|
|
|
public static func navigationController() -> Self? {
|
|
return MVMCoreActionUtility.initializerClassCheck(MVMCoreUISession.sharedGlobal()?.navigationController, classToVerify: self) as? Self
|
|
}
|
|
|
|
public static func style(_ navigationBar: UINavigationBar) {
|
|
UIColor.mfSetBackgroundColor(forNavigationBar: .white, navigationBar: navigationBar, transparent: false)
|
|
navigationBar.shadowImage = UIImage()
|
|
navigationBar.isOpaque = true
|
|
navigationBar.tintColor = .black
|
|
let font = MFFonts.mfFont75Bd(MFSizeObject(standardSize: 13, standardiPadPortraitSize: 16, iPadProLandscapeSize: 18)?.getValueBasedOnScreenSize() ?? 13)
|
|
|
|
navigationBar.titleTextAttributes = [NSAttributedString.Key.font: font];
|
|
}
|
|
|
|
public static func setupNavigationController() -> Self? {
|
|
let navigationController = self.init()
|
|
style(navigationController.navigationBar)
|
|
navigationController.separatorView = Line(pinTo: navigationController.navigationBar, edge: .bottom, useMargin: false)
|
|
navigationController.separatorView?.setStyle(.standard)
|
|
MVMCoreUISession.sharedGlobal()?.navigationController = navigationController
|
|
MVMCoreNavigationHandler.shared()?.viewControllerToPresentOn = navigationController
|
|
MVMCoreNavigationHandler.shared()?.navigationController = navigationController
|
|
return navigationController
|
|
}
|
|
|
|
public static func setupNavigationControllerAsMainController() -> Self? {
|
|
guard let navigationController = setupNavigationController() else { return nil }
|
|
MVMCoreUISession.sharedGlobal()?.setup(asStandardLoadViewDelegate: navigationController)
|
|
return navigationController
|
|
}
|
|
}
|