コンテンツにスキップ


向きをカスタマイズする

すべてのアプリ内メッセージの向きの設定

すべてのアプリ内メッセージの向きを固定するには、ABKInAppMessageUIControllerのsupportedOrientationMaskプロパティを設定します。アプリがstartWithApiKey:inApplication:withLaunchOptions:を呼び出した後に、次のコードを追加します。

// Set fixed in-app message orientation to portrait.
// Use UIInterfaceOrientationMaskLandscape to display in-app messages in landscape
id<ABKInAppMessageUIControlling> inAppMessageUIController = [Appboy sharedInstance].inAppMessageController.inAppMessageUIController;
((ABKInAppMessageUIController *)inAppMessageUIController).supportedOrientationMask = UIInterfaceOrientationMaskPortrait;
// Set fixed in-app message orientation to portrait
// Use .landscape to display in-app messages in landscape
if let controller = Appboy.sharedInstance()?.inAppMessageController.inAppMessageUIController as? ABKInAppMessageUIController {
  controller.supportedOrientationMask = .portrait
}

その後、すべてのアプリ内メッセージは、デバイスの向きに関係なく、サポートされている向きで表示されます。メッセージを表示するには、デバイスの向きがアプリ内メッセージのorientationプロパティでもサポートされている必要があることに注意してください。

アプリ内メッセージごとの向きの設定

または、メッセージごとに向きを設定することもできます。これを行うには、アプリ内メッセージデリゲートを設定します。次に、beforeInAppMessageDisplayed:デリゲートメソッドで、ABKInAppMessageのorientationプロパティを設定します。

// Set inAppMessage orientation to portrait
inAppMessage.orientation = ABKInAppMessageOrientationPortrait;

// Set inAppMessage orientation to landscape
inAppMessage.orientation = ABKInAppMessageOrientationLandscape;
  // Set inAppMessage orientation to portrait
  inAppMessage.orientation = ABKInAppMessageOrientation.portrait

  // Set inAppMessage orientation to landscape
  inAppMessage.orientation = ABKInAppMessageOrientation.landscape

デバイスの向きがアプリ内メッセージのorientationプロパティと一致しない場合、アプリ内メッセージは表示されません。

メソッド宣言

追加情報については、次のヘッダーファイルを参照してください。

New Stuff!