
- iOS Tutorial
- iOS - Home
- iOS - Getting Started
- iOS - Environment Setup
- iOS - Objective-C Basics
- iOS - First iPhone Application
- iOS - Actions and Outlets
- iOS - Delegates
- iOS - UI Elements
- iOS - Accelerometer
- iOS - Universal Applications
- iOS - Camera Management
- iOS - Location Handling
- iOS - SQLite Database
- iOS - Sending Email
- iOS - Audio & Video
- iOS - File Handling
- iOS - Accessing Maps
- iOS - In-App Purchase
- iOS - iAd Integration
- iOS - GameKit
- iOS - Storyboards
- iOS - Auto Layouts
- iOS - Twitter & Facebook
- iOS - Memory Management
- iOS - Application Debugging
- iOS Useful Resources
- iOS - Quick Guide
- iOS - Useful Resources
- iOS - Discussion
Disable Orientation Change in iOS
There are numerous application which either runs on Portrait mode or in Landscape mode.
Restricting the application in one of the mode is important to achieve this.
In this post we will see how to restrict the orientation or disable the orientation to one mode.
If you want the application to be running only in Portrait mode,
Below your viewDidLoad method copy the below line of code
override var supportedInterfaceOrientations: UIInterfaceOrientationMask { get { return .portrait } }
This will lock the landscape mode for your application. Similarly by replacing .portrait to .landscape will run your application in landscape mode.
If not specified your application will run on both mode.
Alternatively you can lock the orientation from Xcode Builder as shown below.
- Related Articles
- How to disable orientation change in Android?
- How to lock Screen Orientation programmatically in iOS?
- Disable Scroll View Programmatically in iOS?
- How to disable the network in iOS Simulator?
- How to enable/disable data connection in iOS programmatically?
- How to handle orientation change android?
- How to detect orientation change in layout in android?
- How to change the orientation of a slider in JavaFX?
- How to detect orientation change in layout in Android using Kotlin?
- How to make an application ignore screen orientation change in Android?
- How to change Screen Orientation programmatically using a Button in Android?
- Change Color of Button in iOS when Clicked
- How to change screen brightness programmatically in iOS?
- How to change Screen Orientation programmatically using a Button in Android Kotlin?
- How to change the orientation of nodes in a tile pane using JavaFX?

Advertisements