| | |
| | | } |
| | | |
| | | } |
| | | |
| | | // 是否支持自动转屏 |
| | | override var shouldAutorotate: Bool { |
| | | guard let navigationController = selectedViewController as? UINavigationController else { return selectedViewController?.shouldAutorotate ?? false } |
| | | return navigationController.topViewController?.shouldAutorotate ?? false |
| | | } |
| | | |
| | | // 支持哪些屏幕方向 |
| | | override var supportedInterfaceOrientations: UIInterfaceOrientationMask { |
| | | guard let navigationController = selectedViewController as? UINavigationController else { return selectedViewController?.supportedInterfaceOrientations ?? .portrait } |
| | | return navigationController.topViewController?.supportedInterfaceOrientations ?? .portrait |
| | | } |
| | | |
| | | // 默认的屏幕方向(当前ViewController必须是通过模态出来的UIViewController(模态带导航的无效)方式展现出来的,才会调用这个方法) |
| | | override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation { |
| | | guard let navigationController = selectedViewController as? UINavigationController else { return selectedViewController?.preferredInterfaceOrientationForPresentation ?? .portrait } |
| | | return navigationController.topViewController?.preferredInterfaceOrientationForPresentation ?? .portrait |
| | | } |
| | | } |
| | | |
| | | class CustomTabbar:UITabBar{ |