2012-12-10 157 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"]) {....} 

这对我有用。

相关问题