2012-12-10 156 views
3

我有一個奇怪的問題。當我在模擬器上運行我的應用程序時,一切正常,但在設備上,一些代碼無論如何都沒有反應。我有一個UIActionSheet,在模擬器上看起來不錯,但在設備上它根本不工作。它甚至工作在iPod ..UIAction表不工作在iPad上,但在模擬器工作

這裏是我的代碼顯示動作片:使用該委託動作片

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ 
if ([actionSheet buttonTitleAtIndex:buttonIndex] == @"A") {....} 
if ([actionSheet buttonTitleAtIndex:buttonIndex] == @"B") {....} 
} 

朋友即時尋找你的幫助

UIActionSheet *DeleteAction = [[UIActionSheet alloc] initWithTitle:@"Select Delete Option" delegate:self cancelButtonTitle:Nil destructiveButtonTitle:nil otherButtonTitles:nil, nil]; 
[DeleteAction addButtonWithTitle:@"A"]; 
[DeleteAction addButtonWithTitle:@"B"]; 
[DeleteAction showInView:self.view]; 

和IM .. 。 在此先感謝 阿彌陀佛

+1

首先嚐試從iPad上刪除應用程序,然後使用Xcode重新安裝.. –

+0

沒有運氣兄弟.... – Amitabha

回答

2

我已經使用此代碼,工作正常。告訴我是否顯示作業單

-(void)share { 
    UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:nil otherButtonTitles:@"Email this Info",@"Tweet this Info",@"Share On Facebook", nil]; 
    popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque; 
    [popupQuery showInView:self.view]; 
    [popupQuery release]; 
} 

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { 
    if (buttonIndex == 0) { 
     [self emailinfo]; 
    } 
    if (buttonIndex == 1) { 
     [self tweetinfo]; 
    } 
    if (buttonIndex == 2) { 
     [self shareonfacebook]; 
    } 
    if (buttonIndex == 3) { 

    } 
} 
+0

actionSheet正在顯示,但與其關聯的委託沒有響應。 – Amitabha

+0

sri - 我試過我們的代碼..但沒有運氣..!同樣的問題.. – Amitabha

+0

試試這個如果([[actionSheet buttonTitleAtIndex:buttonIndex] isEqual:@「A」]) { } – sri

2

問題解決了。

if ([[actionSheet buttonTitleAtIndex:buttonIndex]isEqualToString: @"A"]) {....} 

這對我有用。

相關問題