iOS 7:在UIActionSheet委托功能中创建的UIAlertView无法自动旋转 [英] iOS 7: UIAlertView created in UIActionSheet delegate function cannot auto rotate

查看:101
本文介绍了iOS 7:在UIActionSheet委托功能中创建的UIAlertView无法自动旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该问题只能在iOS 7中重现。

The issue only can be reproduced in iOS 7.

在委托函数中: - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex ,如果创建了UIAlertView,则警报视图无法自动旋转。以下是示例代码:

In the delegate function:- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex, if a UIAlertView is created, the alert view cannot auto rotate. Here is the sample code:

- (IBAction)buttonTapped:(id)sender
{
    UIActionSheet *actionSheet = [[UIActionSheet alloc]
                                  initWithTitle:@"action sheet"
                                  delegate:self
                                  cancelButtonTitle:@"cancel"
                                  destructiveButtonTitle:@"ok"
                                  otherButtonTitles:nil];
    [actionSheet showInView:self.view];
}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    UIAlertView *alert = [[UIAlertView alloc]
                          initWithTitle:@"alert"
                          message:nil
                          delegate:self
                          cancelButtonTitle:@"ok"
                          otherButtonTitles:nil];
    [alert show];
}

这是iOS 7的错误吗?如果是,是否有任何方法可以使警报视图与屏幕中的其他视图一起自动旋转?

Is this a bug of iOS 7? If yes, is there any way to make the alert view auto rotate with the other view in the screen?

推荐答案

尝试展示来自UIActionSheet的另一个委托方法的alertview。这确实有效:

Try presenting the alertview from another delegate method of UIActionSheet. This does work:

- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex

这肯定看起来像是iOS7中的错误:)

This surely looks like a bug in iOS7 :)

这篇关于iOS 7:在UIActionSheet委托功能中创建的UIAlertView无法自动旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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