我创建了一个自定义 UIAlertView (通过子类化它并弄乱它的show函数),它有一些自定义子视图并且具有非标准尺寸。
当我创建并显示它时,它工作正常,但是,当旋转设备时,警报会旋转,然后返回到其默认大小。
任何想法要覆盖什么功能 - 或者我应该调整 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];
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)