How do I disable landscape-orientation on an iPad app?
Its work perfectly. Dont need to write code for it.
First select project and then go in first tab "General".
Now select "Devices" option in Deployment info section is iPad and in that down select Device orientation .. In which remove checkmark from landscape Left, Right option
After done select it back device as universal and set device orientation as portrait..mode and remove check mark from landscape mode.
Now run your app in iPad and check that things. I hope it will be resolved.
There are separate entries in Info.plist for iPhone and iPad supported orientations.
- iPhone = UISupportedInterfaceOrientations
- iPad = UISupportedInterfaceOrientations~ipad
You need to modify Info.plist and remove landscape entries for UISupportedInterfaceOrientations~ipad key.
Works for me!
Open info.plist
as source code, you will see these properties:
UISupportedInterfaceOrientations
: For iPhoneUISupportedInterfaceOrientations~ipad
: For iPad
Under UISupportedInterfaceOrientations~ipad
remove your unwanted orientation mode. In my case, I want only Portrait Mode so I removed the rest modes and then save it.
Done! Good Luck