0

スワイプしてテーブルビューの削除ボタンをクリックすると、アラートの確認が必要です。基本的に、データを送信する前に「OK」と「キャンセル」ボタンでアラートポップアップを表示したい:

[[ConnectionSingleton getInstance] sendData:[NSString stringWithFormat:@"modifOrderFoodState::%@::%@::%@", [cellOrder objectForKey:@"orderFoodRelId"], state, [ConnectionSingleton getInstance].restaurantId] ];

クライアントがキャンセル ボタンをクリックすると、データ送信機能が中止されます。

これは私のコードです:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

NSMutableDictionary *cellOrder = [orders objectAtIndex:indexPath.row];
NSString *state = @"4";

if (editingStyle == UITableViewCellEditingStyleDelete) {


    [[ConnectionSingleton getInstance] sendData:[NSString stringWithFormat:@"modifOrderFoodState::%@::%@::%@",
                                                 [cellOrder objectForKey:@"orderFoodRelId"],
                                                 state,
                                                 [ConnectionSingleton getInstance].restaurantId] ];
  }    
}

ありがとう

4

1 に答える 1

1

このクラスを UIAlertViewDelegate にします。スタイルが削除の場合、UIAlertView を作成します。送信データ コードを alertView:clickedButtonAtIndex: メソッドに移動し、ユーザーが [OK] をクリックした場合に実行します。

于 2012-04-17T16:21:44.793 に答える