Fix PR issue from Ivan Smolin

This commit is contained in:
Boyko Mihail 2020-09-23 14:48:08 +03:00
parent f62ad5be5f
commit 0bc80d98b8
2 changed files with 6 additions and 10 deletions

View File

@ -31,12 +31,8 @@ open class BaseConfigurableController<ViewModel>: UIViewController, Configurable
/// A view model instance used by this controller.
public let viewModel: ViewModel
override var interfaceOrientation: UIInterfaceOrientation {
return forcedInterfaceOrientation ?? super.interfaceOrientation
}
open override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
switch interfaceOrientation {
switch forcedInterfaceOrientation {
case .landscapeLeft:
return .landscapeLeft
@ -50,12 +46,12 @@ open class BaseConfigurableController<ViewModel>: UIViewController, Configurable
return .portraitUpsideDown
default:
return .portrait
return super.supportedInterfaceOrientations
}
}
open override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
return interfaceOrientation
return forcedInterfaceOrientation ?? super.preferredInterfaceOrientationForPresentation
}
/// Initializer with view model parameter.

View File

@ -8,18 +8,18 @@ open class OrientationNavigationController: UINavigationController {
open override var shouldAutorotate: Bool {
return presentedViewController?.shouldAutorotate
?? topViewController?.shouldAutorotate
?? false
?? super.shouldAutorotate
}
open override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return presentedViewController?.supportedInterfaceOrientations
?? topViewController?.supportedInterfaceOrientations
?? .portrait
?? super.supportedInterfaceOrientations
}
open override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
return presentedViewController?.preferredInterfaceOrientationForPresentation
?? topViewController?.preferredInterfaceOrientationForPresentation
?? .portrait
?? super.preferredInterfaceOrientationForPresentation
}
}