It may be useful for others, I found a way to force the view to launch in landscape mode:
Put this in the viewDidLoad():
let value = UIInterfaceOrientation.landscapeLeft.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
and,
override var shouldAutorotate: Bool {
return true
}
More Related Contents:
- Displaying images on another view controller when button is clicked
- Instantiate and Present a viewController in Swift
- Passing data between view controllers
- Programmatically set the initial view controller using Storyboards
- Detecting sheet was dismissed on iOS 13
- UIViewController returns invalid frame?
- Adding a view controller as a subview in another view controller
- How to set Status Bar Style in Swift 3
- Passing data back from view controllers Xcode
- How to pass Textfield value to view controller through button click in Swift UI
- Opening view controller from app delegate using swift
- How to reload data in a TableView from a different ViewController in Swift
- Present modal view controller in half size parent controller
- How to check if a view controller is presented modally or pushed on a navigation stack?
- Passing Image to another View Controller (Swift)
- Access Container View Controller from Parent iOS
- How to get UIScrollView vertical direction in Swift?
- How to maintain presenting view controller’s orientation when dismissing modal view controller?
- Changing VC issue in Swift. How to pass data between views in tab bar controller?
- Custom init for UIViewController in Swift with interface setup in storyboard
- How to push and present to UIViewController programmatically without segue in iOS Swift 3
- Swift – Saving highscore using NSUserDefaults
- single function to dismiss all open view controllers
- Initializer does not override a designated initializer from its superclass
- How to call method from ViewController in GameScene
- Expected declaration error for making high score [duplicate]
- Swift – How to dismiss all of view controllers to go back to root
- In SwiftUI, how to use UIHostingController inside an UIView or as an UIView?
- Rotation only in one ViewController
- Can’t cast value of type UIViewController to PatternDetailViewController