旋转UIAlertView

我创build了一个自定义的UIAlertView(通过inheritance它的子类和它的show函数),它有一些自定义的子视图,并且是非标准的大小。

当我创build并显示它时,它工作正常,但是,当设备旋转时,警报会旋转,然后返回到其默认大小。

任何想法什么function重写 – 或者我应该调整UIViewController?

谢谢,彼得

不确定旋转UIAlertView的力量是否符合Apple GUI的指导原则,但是您可以通过定义状态栏(状态栏和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]; }