Screen

Screen Configuration #

You can control the screen orientation and full screen display of the SDK according to the specific scene of the application.

ScreenOrientation

The configuration is controlled by AndroidManefest.xml, regardless of platform.

To change the screen orientation of the SDK, just add android:screenOrientation tag to HostActivity declaration .

Here are the optional values:

  • portrait
  • landscape
  • sensor
<application>
    <activity
        android:name="net.aihelp.ui.HostActivity"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize"
        android:screenOrientation="landscape"
        tools:node="replace"/>
</application>

FullScreen

If you need to configure the SDK full screen display, you need to configure a full screen theme to HostActivity .

Define a full screen style in the res/values/styles file:

<style name="AIHelpTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>
</style>

then configure this theme to HostActivity in your AndroidManifest.xml

<application>
    <activity
        android:name="net.aihelp.ui.HostActivity"
        android:theme="@style/AIHelpTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize"
        android:screenOrientation="landscape"
        tools:node="replace"/>
</application>

Note:

Please make sure you are using tools:node= "Replace" to force override, otherwise the configuration may not take effect.

1. Setting screen orientation

  • configure via Xcode

    General->Deployment Info->Device Orientation

  • configure in AppDelegate.m

      - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
          return UIInterfaceOrientationMaskAll;
      }
    

2. Code example:

// to support all directions
[AIHelpSupportSDK setSDKInterfaceOrientationMask:UIInterfaceOrientationMaskAll];

// to support horizontal orientation
[AIHelpSupportSDK setSDKInterfaceOrientationMask:UIInterfaceOrientationMaskLandscape];

// to support vertical orientation
[AIHelpSupportSDK setSDKInterfaceOrientationMask:UIInterfaceOrientationMaskPortrait];

typedef NS_OPTIONS(NSUInteger, UIInterfaceOrientationMask) {
    UIInterfaceOrientationMaskPortrait,         
    UIInterfaceOrientationMaskLandscapeLeft,    
    UIInterfaceOrientationMaskLandscapeRight,   
    UIInterfaceOrientationMaskPortraitUpsideDown,
    UIInterfaceOrientationMaskLandscape,          
    UIInterfaceOrientationMaskAll,              
    UIInterfaceOrientationMaskAllButUpsideDown  
}

Note:

  1. The system’s camera and photo album functions are used for uploading pictures in the form, so the vertical screen option permission must be enabled, otherwise calling the system camera function will result in application crash;

  2. If the game is horizontal and vertical is enabled, which affects the direction of the game, you can add the supportedinterfaceorientations method to the rootviewcontroller. M file and return the support direction of the game

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
			return UIInterfaceOrientationMaskLandscape;
}