3

私は奇妙な問題を抱えています。シミュレーターでアプリを実行するとすべて正常に動作しますが、デバイスでは一部のコードが応答しません! シミュレーターではかなり良いように見える UIActionSheet がありますが、デバイスではまったく機能していません。iPodでも動作します:

アクションシートを表示するコードは次のとおりです。

 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];

そして、私はアクションシートにこのデリゲートを使用しています

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

2 に答える 2

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) {

    }
}
于 2012-12-10T06:54:01.057 に答える
2

問題が解決しました 。

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

これは私のために働いた。

于 2013-02-05T09:21:35.337 に答える