首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >旋转UIAlertView

旋转UIAlertView
EN

Stack Overflow用户
提问于 2011-07-28 13:06:37
回答 1查看 7K关注 0票数 7

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

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

有什么想法可以覆盖哪些功能--或者我应该调整UIViewController?

谢谢,彼得

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-07-28 13:10:11

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

代码语言:javascript
复制
application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;
application.statusBarOrientation = UIInterfaceOrientationLandscapeLeft;

但是UIAlertView和许多其他的UIView一样是一个UIView,所以请尝试如下:

代码语言:javascript
复制
- (void)didPresentAlertView:(UIAlertView *)alertView
{
    [UIView beginAnimations:@"" context:nil];
    [UIView setAnimationDuration:0.1];
    alertView.transform = CGAffineTransformRotate(alertView.transform, degreesToRadian(90));
    [UIView commitAnimations];
}
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6859438

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档