RoomNavigationController.swift 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. //
  2. // RoomNavigationController.swift
  3. // DemoApp
  4. //
  5. // Created by janejntang on 2023/12/11.
  6. //
  7. import Foundation
  8. import UIKit
  9. class RoomNavigationController: UINavigationController {
  10. override init(rootViewController: UIViewController) {
  11. super.init(rootViewController: rootViewController)
  12. interactivePopGestureRecognizer?.isEnabled = false
  13. }
  14. required init?(coder aDecoder: NSCoder) {
  15. fatalError("init(coder:) has not been implemented")
  16. }
  17. override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
  18. super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
  19. }
  20. override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
  21. guard let supportedInterfaceOrientations = topViewController?.supportedInterfaceOrientations as? UIInterfaceOrientationMask
  22. else { return .portrait }
  23. return supportedInterfaceOrientations
  24. }
  25. override var shouldAutorotate: Bool {
  26. guard let shouldAutorotate = topViewController?.shouldAutorotate else { return false }
  27. return shouldAutorotate
  28. }
  29. }