0

現在、iPad でアプリケーションを開発中です。縦向きのみに対応しており、横向きには対応していません。ランドスケープ レフトをサポートするには、.m ファイルでどのコード (どのファイル) を編集または追加する必要がありますか? それをサポートするには、アプリ内のすべてのページが必要です。

4

2 に答える 2

1

すべての UIViewController は、このメソッドを実装する必要があります:

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

少数のみをサポートしたい場合 (サポートしたくないものには NO を返すだけです):

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    //Allow Original Portrait
    if(interfaceOrientation == UIInterfaceOrientationPortrait)
    {
        return YES;
    }
    //Allow Upside Down
    else if(interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
    {
        return YES;
    }
    //Allow Landscape Left
    else if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
    {
        return YES;
    }
    //Allow Landscape Right
    else if(interfaceOrientation == UIInterfaceOrientationLandscapeRight)
    {
        return YES;
    }
}
于 2012-06-25T15:43:48.427 に答える
0

各ビュー コントローラーで、次のコードを追加する必要があります。

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {    
    return ((interfaceOrientation == UIInterfaceOrientationPortrait) || (interfaceOrientation == UIInterfaceOritentationPortraitUpsideDown));
 }
于 2012-06-25T15:45:24.487 に答える