2013-10-21 33 views
2

只能在iOS的7的iOS 7:在UIActionSheet委託函數創建的UIAlertView中無法自動旋轉

在委託函數被複制的問題:- (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的bug嗎?如果是,有什麼辦法讓警報視圖自動與屏幕上的其他視圖一起旋轉?

回答

3

嘗試使用UIActionSheet的另一個委託方法呈現alertview。這並不工作:

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

這無疑看起來像iOS7的錯誤:)

+0

您的解決方案的工作,謝謝。 – yzyanchao