旋转UIAlertView [英] Rotating a UIAlertView

查看:55
本文介绍了旋转UIAlertView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个自定义UIAlertView(通过子类化并使用其 show 函数搞乱),它具有一些自定义子视图并且具有非标准大小。

I've created a custom UIAlertView (by subclassing it and messing around with its show function) that has some custom subviews and is of non-standard size.

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

It works ok when I create and display it, however, when the device is rotated, the alert rotates and then returns to its default size.

任何想法要覆盖哪些函数 - 或者我应该调整UIViewController?

Any ideas what functions to override - or should I tweak the UIViewController?

谢谢,
Peter

thanks, Peter

推荐答案

不确定强制旋转UIAlertView是否符合Apple GUI指南,但您可以通过定义状态栏(状态栏和UIAlertView粘在一起)来旋转它

Not sure if force rotating the UIAlertView fits the Apple GUI guidelines, but you can rotate it by defining the status bar (status bar and UIAlertView sticks together)

application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;
application.statusBarOrientation = UIInterfaceOrientationLandscapeLeft;

但UIAlertView就像许多其他人一样是UIView,所以试试这个:

But UIAlertView is a UIView just like many others, so try this :

- (void)didPresentAlertView:(UIAlertView *)alertView
{
    [UIView beginAnimations:@"" context:nil];
    [UIView setAnimationDuration:0.1];
    alertView.transform = CGAffineTransformRotate(alertView.transform, degreesToRadian(90));
    [UIView commitAnimations];
}

这篇关于旋转UIAlertView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆