当我滑动并单击表格视图上的删除按钮时,我想要一个警报确认。基本上我想在发送数据之前显示一个带有“确定”和“取消”按钮的警报弹出窗口:
[[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] ];
}
}
谢谢