We have an application developed using ionic and Xamarin framework.
We have a requirement of restricting some of the views to Portrait.
Is it possible to restrict orientation for some views in ionic+Xamarin or even ionic+phonegap applications?
I found [this post][1] that states:
I am using these plugins :
- Cordova Screen Plugin Orientation : https://github.com/yoik/cordova-yoik-screenorientation17
- And, this is as dependencies for cordova screen plugin orientation (only for iOS) : https://github.com/Adlotto/cordova-plugin-recheck-screen-orientation6
$ cordova plugin add https://github.com/Adlotto/cordova-plugin-recheck-screen-orientation.git4 $ cordova plugin add net.yoik.cordova.plugins.screenorientation
Then in your app (usualy in config), just check which page that should be portrait or landscape (it’s more flexible rather than global preferences)
//check orientation console.log('Orientation is ' + screen.orientation); if(toState.orientation == 'portrait') { screen.lockOrientation('portrait'); }else{ screen.lockOrientation('landscape'); }
perhaps it will help
that might be of some use to you
[1]: Freezing portrait mode - #8 by donny