我创建了一个自定义 UIAlertView (通过对其进行子类化并使用其显示功能),它具有一些自定义子视图并且具有非标准大小。
当我创建和显示它时它工作正常,但是,当设备旋转时,警报旋转然后返回到其默认大小。
任何想法要覆盖哪些功能 - 或者我应该调整 UIViewController?
谢谢,彼得
我创建了一个自定义 UIAlertView (通过对其进行子类化并使用其显示功能),它具有一些自定义子视图并且具有非标准大小。
当我创建和显示它时它工作正常,但是,当设备旋转时,警报旋转然后返回到其默认大小。
任何想法要覆盖哪些功能 - 或者我应该调整 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];
}