質問

ポートレートから風景へと回転する方法は?何を実装する必要がありますか?そして、私の見解が新しい幅にサイズを変更することは何をしなければなりませんか?

役に立ちましたか?

解決

以下のメソッド「return yes」は、「return no」である場合、方向が変更されます。方向は変わりません。

- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) orientation 
{

 return YES;

}

ではごきげんよう。

他のヒント

質問の2番目の部分に答えるために、ロジックを追加してサイズを変更したり、ビューをオーバーライドしたりすることで表示できます。 -willRotateToInterfaceOrientation:duration: 方法、例:

- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
    if (toInterfaceOrientation == UIDeviceOrientationUnknown || toInterfaceOrientation == UIDeviceOrientationFaceUp || toInterfaceOrientation == UIDeviceOrientationFaceDown) {
        // do something here for these orientations
    }
    else {
        // do something else for the remaining orientation types
    }
}

ビューコントローラーがトップレイヤービューコントローラーでない場合は、メッセージを渡す必要があります willrotatetointerfaceorientation:期間: トップレイヤービューコントローラーから..ビューコントローラーはメッセージを受信しない可能性があります...

私のトップレイヤービューコントローラーのWillrotatetointerfaceorientation:duration:、私はこの行を含めました...(frameviewcontrollerは私の2番目のレベルビューコントローラーです)

if (frameViewController)
        [frameViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top