PQNavigatinController.swift 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // PQNavigatinController.swift
  3. // PQSpeed
  4. //
  5. // Created by SanW on 2020/5/25.
  6. // Copyright © 2020 BytesFlow. All rights reserved.
  7. //
  8. import UIKit
  9. open class PQNavigatinController: UINavigationController, UIGestureRecognizerDelegate {
  10. public var isPop: Bool = false
  11. open override func viewDidLoad() {
  12. super.viewDidLoad()
  13. // Do any additional setup after loading the view.
  14. }
  15. open override func pushViewController(_ viewController: UIViewController, animated _: Bool) {
  16. if viewControllers.count > 0 {
  17. viewController.hidesBottomBarWhenPushed = true
  18. }
  19. super.pushViewController(viewController, animated: true)
  20. }
  21. public func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
  22. return topViewController!.supportedInterfaceOrientations
  23. }
  24. public func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {
  25. return topViewController!.preferredInterfaceOrientationForPresentation
  26. }
  27. open override var childForStatusBarStyle: UIViewController? {
  28. return topViewController
  29. }
  30. open override var childForStatusBarHidden: UIViewController? {
  31. return topViewController
  32. }
  33. public func gestureRecognizerShouldBegin(_: UIGestureRecognizer) -> Bool {
  34. return viewControllers.count > 1
  35. }
  36. }