
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Questions & Answers
- How to disable orientation change in Android?
- How to lock Screen Orientation programmatically in iOS?
- Disable Scroll View Programmatically in iOS?
- How to handle orientation change android?
- How to disable the network in iOS Simulator?
- How to detect orientation change in layout in android?
- How to enable/disable data connection in iOS programmatically?
- How to change the orientation of a slider in JavaFX?
- How to detect orientation change in layout in Android using Kotlin?
- How to change Screen Orientation programmatically using a Button in Android?
- How to make an application ignore screen orientation change 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