縦向きから横向きに回転するには?何を実装する必要がありますか?ビューのサイズを新しい幅に変更するにはどうすればよいですか?
3 に答える
2
以下のメソッド「return yes」は向きを変えますが、「return NO」なら向きは変わりません。
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) orientation
{
return YES;
}
ではごきげんよう。
于 2010-06-29T20:08:56.720 に答える
0
ビュー コントローラーが最上位のビュー コントローラーでない場合は、メッセージwillRotateToInterfaceOrientation:duration:を最上位のビュー コントローラーから渡す必要があります。ビュー コントローラーはメッセージを受信しない可能性があります...
最上位のビュー コントローラーの willRotateToInterfaceOrientation:duration: で、この行を含めました... (frameViewController は私の第 2 レベルのビュー コントローラーです)
if (frameViewController)
[frameViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
于 2010-08-25T03:59:32.030 に答える
0
質問の 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
}
}
于 2010-06-29T20:20:32.187 に答える