7

いくつかのカスタム サブビューを持ち、非標準サイズのカスタム UIAlertView を (サブクラス化し、そのshow関数をいじることによって) 作成しました。

作成して表示すると問題なく動作しますが、デバイスを回転させると、アラートが回転してデフォルトのサイズに戻ります。

どの機能をオーバーライドするか、または UIViewController を微調整する必要がありますか?

ありがとう、ピーター

4

1 に答える 1

4

UIAlertViewを強制的に回転させることがAppleGUIガイドラインに適合するかどうかはわかりませんが、ステータスバーを定義することで回転させることができます(ステータスバーとUIAlertViewはくっつきます)

application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;
application.statusBarOrientation = UIInterfaceOrientationLandscapeLeft;

ただし、UIAlertViewは他の多くのUIViewと同じであるため、これを試してください。

- (void)didPresentAlertView:(UIAlertView *)alertView
{
    [UIView beginAnimations:@"" context:nil];
    [UIView setAnimationDuration:0.1];
    alertView.transform = CGAffineTransformRotate(alertView.transform, degreesToRadian(90));
    [UIView commitAnimations];
}
于 2011-07-28T13:10:11.823 に答える