Firstly, I looked at many other streams in portrait / landscape orientation for iOS.
I have a hybrid application that is built using IBM Worklight (I am mainly focused on the iOS platform, since I already have a solution for Android that works fine). I added the cordova plugin to access device features. My application should be set to portrait on all screens except one. On one screen (view) I need to maintain a landscape and portrait. However, when I switch to another screen, I need to return only to the portrait, but in my many attempts to stay in the landscape.
I use the techniques supportedInterfaceOrientationsand shouldAutorotateto lock and unlock and switch between support only portrait or landscape and portrait.
Note. My application has only one view controller that contains a webview, so I cannot use solutions to reject and present a modal controller.
I also looked at other topics that mention rotation of power using conversion in iOS, but that doesn't work either. Is there a documented way to set iPhone orientation?
(My app supports iOS7 and above) The only thing that worked for me was
[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];
and
objc_msgSend([UIDevice currentDevice], @selector(setOrientation:), UIInterfaceOrientationPortrait );
However, Apple will reject my application if I use it due to a private api.
Is there any other way to force portrait orientation when the device is rotated to landscape?