该问题只能在 iOS 7 中重现。
在委托函数中:- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
如果创建了 UIAlertView,则警报视图无法自动旋转。这是示例代码:
- (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的错误吗?如果是,有没有办法让警报视图与屏幕中的其他视图一起自动旋转?