Handling Orientation
If you are using an app with a portrait main menu and landscape gameplay, this article will help you understand how to make your application orientation work correctly with the OS UI.
This page is only needed if you have a game with landscape gameplay and plan to use a portrait main-menu.
To make sure that the OS menu bar renders correctly, make sure that any UIViewControllers
you use have their supportedInterfaceOrientations
function declared. For example for a landscape view you would want to have the following:
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
and for the portrait view the view controller should have the following:
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
To make sure that the OS menu bar renders correctly, make sure that any UIViewControllers
you use have their supportedInterfaceOrientations
function overridden. For example for a landscape view you would want to have the following:
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.landscape
}
and for the portrait view the view controller should have the following:
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.portrait
}
The Android SDK works using Android Activities, defined in your manifest through skillz_game_activity
and skillz_exit_activity
. You are responsible for making sure that your activities are declared with your desired android:screenOrientation
settings inside of the app's AndroidManifest.xml
.
If you use a mix of landscape and portrait views (such as having a portrait main-menu and landscape in-game views) you can control the screen orientation by setting Screen.orientation
. (Ex: a landscape view that uses Screen.orientation = ScreenOrientation.Landscape;
).
Your Cordova application will be responsible for handling orientation in the menu and in the game screens. Skillz will be responsible for handling orientation while Skillz UI is displaying.