![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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.
Advertisements