Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force a Swift iOS app only in portrait mode

Tags:

ios

swift

uiview

I am writing an iOS app in Swift and I would like to prevent the user from using the app in landscape mode. Is there a way to easily block any view to portrait mode only?

like image 211
Diuoo Avatar asked Oct 21 '25 14:10

Diuoo


2 Answers

yes you can do the following

  1. Click on the icon of your app: app

  2. You should get this: this

Then you set only portrait mode

like image 172
Giovanni Gaffé Avatar answered Oct 23 '25 05:10

Giovanni Gaffé


Just go to you app setting -> Deployment Info -> Device Orientation, and tick on "Portrait" only

like image 28
Minh Văn Avatar answered Oct 23 '25 03:10

Minh Văn