iOS 9 supportedInterfaceOrientations not working
I don't think Bryan's answer works,for changing the orientations in project settings also changes the info.plist
as @mrhangz commented.
If the issue is iOS9 only,it is probably due to the new feature of iOS9 in iPad called Split view
.The iOS9 enable Split view
by default in particular iPad device,see Apple documents here.
The split view
forced your app to support all orientations in all view once adoptted.So if you set all orientations support in either info.plist
or target general setting,and then split view
is supported by default,which will ignore the orientation setting though supportedInterfaceOrientations
in your viewController and support all orientations.
As the document written,if you checked Requires full screen
in your target settings,then your app will not support split view
.Now you can control orientations in code again.
So the issue was that I had defined the allowed orientations in info.plist
which apparently overrides anything you do anywhere else throughout the project.
To correct the issue I removed the entries from info.plist
and defined them in the project settings. Now everything works as expected.