This commit is contained in:
Boyko Mihail 2020-10-05 10:31:48 +03:00
parent 5297be522f
commit 2bd38efab0
1 changed files with 8 additions and 7 deletions

View File

@ -1,25 +1,26 @@
import RxSwift
import UIKit
open class OrientationNavigationController: UINavigationController {
// MARK: - Public properties
var presentedOrTopViewController: UIViewController? {
presentedViewController ?? topViewController
}
open override var shouldAutorotate: Bool {
return presentedViewController?.shouldAutorotate
?? topViewController?.shouldAutorotate
presentedOrTopViewController?.shouldAutorotate
?? super.shouldAutorotate
}
open override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return presentedViewController?.supportedInterfaceOrientations
?? topViewController?.supportedInterfaceOrientations
presentedOrTopViewController?.supportedInterfaceOrientations
?? super.supportedInterfaceOrientations
}
open override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
return presentedViewController?.preferredInterfaceOrientationForPresentation
?? topViewController?.preferredInterfaceOrientationForPresentation
presentedOrTopViewController?.preferredInterfaceOrientationForPresentation
?? super.preferredInterfaceOrientationForPresentation
}
}