Force orientation to portrait on phones

This commit is contained in:
ismailgulek
2020-08-06 16:54:58 +03:00
parent 8deaba292d
commit 7fc85df56b
2 changed files with 44 additions and 1 deletions

View File

@@ -69,6 +69,11 @@ final class EnterPinCodeViewController: UIViewController {
self.viewModel.viewDelegate = self
self.viewModel.process(viewAction: .loadData)
// force orientation to portrait if phone
if UIDevice.current.isPhone {
UIDevice.current.setValue(UIInterfaceOrientation.portrait.rawValue, forKey: "orientation")
}
}
override var preferredStatusBarStyle: UIStatusBarStyle {
@@ -76,7 +81,18 @@ final class EnterPinCodeViewController: UIViewController {
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .portrait
// limit orientation to portrait only for phone
if UIDevice.current.isPhone {
return .portrait
}
return super.supportedInterfaceOrientations
}
override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
if UIDevice.current.isPhone {
return .portrait
}
return super.preferredInterfaceOrientationForPresentation
}
// MARK: - Private