//
// Part 001
//
let purchaseOrderBillVC = PurchaseOrderBillViewController()
let purchaseOrderBillNav = BaseNavigationController.init(rootViewController: purchaseOrderBillVC)
purchaseOrderBillNav.interactivePopGestureRecognizer?.isEnabled = false
let reportFormVC = ReportFormViewController()
let reportFormNav = BaseNavigationController.init(rootViewController: reportFormVC)
reportFormNav.interactivePopGestureRecognizer?.isEnabled = false
let accountVC = AccountViewController()
let accountNav = BaseNavigationController.init(rootViewController: accountVC)
accountNav.interactivePopGestureRecognizer?.isEnabled = false
let messageVC = MessageViewController()
let messageNav = BaseNavigationController.init(rootViewController: messageVC)
messageNav.interactivePopGestureRecognizer?.isEnabled = false
let userVC = UserViewController()
let userNav = BaseNavigationController.init(rootViewController: userVC)
userNav.interactivePopGestureRecognizer?.isEnabled = false
tabBar = UITabBarController()
tabBar?.tabBar.backgroundColor = UIColor.white
tabBar?.selectedIndex = 0
tabBar?.viewControllers = [purchaseOrderBillNav,reportFormNav,accountNav,messageNav,userNav]
window?.rootViewController = tabBar!
//
// Part 002
//
//
// BaseNavigationController.swift
// erp-mobile-supplier
//
// Created by wxd on 2016/12/8.
// Copyright © 2016年 ds365.com. All rights reserved.
//
import UIKit
class BaseNavigationController: UINavigationController {
//MARK: - life
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
//MARK: - self
override init(rootViewController: UIViewController) {
super.init(rootViewController: rootViewController)
self.interactivePopGestureRecognizer?.delegate = self as? UIGestureRecognizerDelegate
self.delegate = self as UINavigationControllerDelegate
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension BaseNavigationController: UINavigationControllerDelegate {
func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
}
func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
if navigationController.viewControllers.count > 1 {
self.interactivePopGestureRecognizer?.isEnabled = true
}else {
self.interactivePopGestureRecognizer?.isEnabled = false
}
}
}