我已经创建了一个自定义的UIAlertView(通过子类化并混合其显示函数),它有一些自定义子视图,并具有非标准大小。
当我创建和显示它时,它工作得很好,然而,当设备旋转时,警报会旋转,然后返回到默认大小。
有什么想法可以重写哪些函数-或者我应该调整UIViewController?
谢谢, 彼得
当我创建和显示它时,它工作得很好,然而,当设备旋转时,警报会旋转,然后返回到默认大小。
有什么想法可以重写哪些函数-或者我应该调整UIViewController?
谢谢, 彼得
不确定强制旋转UIAlertView是否符合苹果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];
}