//
//  PQNavigatinController.swift
//  PQSpeed
//
//  Created by SanW on 2020/5/25.
//  Copyright © 2020 BytesFlow. All rights reserved.
//

import UIKit

open class PQNavigatinController: UINavigationController, UIGestureRecognizerDelegate {
    public var isPop: Bool = false

   open  override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

   open override func pushViewController(_ viewController: UIViewController, animated _: Bool) {
        if viewControllers.count > 0 {
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: true)
    }

   public func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
        return topViewController!.supportedInterfaceOrientations
    }

   public func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {
        return topViewController!.preferredInterfaceOrientationForPresentation
    }

   open override var childForStatusBarStyle: UIViewController? {
        return topViewController
    }

   open override var childForStatusBarHidden: UIViewController? {
        return topViewController
    }

   public func gestureRecognizerShouldBegin(_: UIGestureRecognizer) -> Bool {
        return viewControllers.count > 1
    }
}
