#pragma mark Cell左滑删除购物车记录功能
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath //当在Cell上滑动时会调用此函数
{
return UITableViewCellEditingStyleDelete;
//返回此值时,Cell会做出响应显示Delete按键,点击Delete后会调用下面的函数,别给传递UITableViewCellEditingStyleDelete参数
}
#pragma mark 调用购物车记录删除接口
- (void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
//对选中的Cell根据editingStyle进行操作
if (editingStyle == UITableViewCellEditingStyleDelete)
{
//一层一层解压model,给商品Cell赋值
CartOrderGoodsList *model=self.cartDatas.orderGoodsList[indexPath.section];
CartCarList *carlistModel = model.carList[indexPath.row];
//调用删除购物车记录的接口
[CLHttpRequest createCartDeleteWithC_id: carlistModel.carListIdentifier AndCallBack:^(id obj) {
//调用购物车接口
[self ShopCartList];
} AndScallBack:^(id obj) {
[PromptLabel custemAlertPromAddView:self.view text:obj];
}];
}
}
//将cell滑动删除的文字“delete”改成中文
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{
return @"删除";
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath //当在Cell上滑动时会调用此函数
{
return UITableViewCellEditingStyleDelete;
//返回此值时,Cell会做出响应显示Delete按键,点击Delete后会调用下面的函数,别给传递UITableViewCellEditingStyleDelete参数
}
#pragma mark 调用购物车记录删除接口
- (void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
//对选中的Cell根据editingStyle进行操作
if (editingStyle == UITableViewCellEditingStyleDelete)
{
//一层一层解压model,给商品Cell赋值
CartOrderGoodsList *model=self.cartDatas.orderGoodsList[indexPath.section];
CartCarList *carlistModel = model.carList[indexPath.row];
//调用删除购物车记录的接口
[CLHttpRequest createCartDeleteWithC_id: carlistModel.carListIdentifier AndCallBack:^(id obj) {
//调用购物车接口
[self ShopCartList];
} AndScallBack:^(id obj) {
[PromptLabel custemAlertPromAddView:self.view text:obj];
}];
}
}
//将cell滑动删除的文字“delete”改成中文
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{
return @"删除";
}