1

重複の可能性:
iPhoneまたはiPadのランドスケープモードのみ

私は古いiPhoneを車のメディアハブとして再利用するプロジェクトに取り組んでいます。私が特に必要としているのは、ある種のチュートリアルを入手するか、デフォルトのiOS画面の向きを変更するために必要な手順を具体的に指定することです。

多くの人がCydiaのLandscapeRotationLockを使用してLandscapeモードを無効にしていますが、私の目標は正反対です。

ポートレートモードを無効にしたいのですが、最終的にはiPhoneが車に水平に取り付けられているので、横向きのみが必要になります。

これはどのように行うことができますか?

4

2 に答える 2

0

を使用Supported interface orientationsしてLandscape (left home button)、その値を info.plist ファイルに設定します。これにより、アプリがその向きで起動し、設定する必要があります

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

すべてのviewControllerで。

これがあなたが探しているものであることを願っています。他に何か必要な場合はお知らせください。

アップデート

こんにちは@DanSolo XCodeでアプリケーションを作成したと思いますよね?もしそうなら、ビューコントローラに行き、shouldAutorotateToInterfaceOrientationメソッドをチェックしてください。このメソッドは、デバイスを回転させたときに呼び出されます。はいを返す場合は、回転しません。あなたの場合、あなたは戻ってきます

return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);

これは、横向きの左モードでのみ「はい」を返します。横向きの左右両方を使用する場合

return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || 
        (interfaceOrientation == UIInterfaceOrientationLandscapeRight);

このコードは、すべての viewController のshouldAutorotateToInterfaceOrientationメソッドに含まれます。

それが役に立てば幸い :)

于 2012-07-12T04:22:56.620 に答える
0

これを試して

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
于 2012-07-12T04:06:42.393 に答える