我已经创建了一个定制的UIAlertView (通过子类化它并使用它的显示函数),它具有一些自定义的子视图,并且具有非标准的大小。
当我创建和显示它时,它工作正常,但是,当设备被旋转时,警报会旋转,然后返回到它的默认大小。
有什么想法可以覆盖哪些功能--或者我应该调整UIViewController?
谢谢,彼得
发布于 2011-07-28 13:10:11
不确定强制旋转UIAlertView是否符合Apple准则,但您可以通过定义状态栏(状态栏和UIAlertView粘合在一起)来旋转它。
application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;
application.statusBarOrientation = UIInterfaceOrientationLandscapeLeft;但是UIAlertView和许多其他的UIView一样是一个UIView,所以请尝试如下:
- (void)didPresentAlertView:(UIAlertView *)alertView
{
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:0.1];
alertView.transform = CGAffineTransformRotate(alertView.transform, degreesToRadian(90));
[UIView commitAnimations];
}https://stackoverflow.com/questions/6859438
复制相似问题