|
|
@@ -3348,13 +3348,21 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:
|
|
|
} else {
|
|
|
// 删除Item
|
|
|
NSInteger item_count = [self itemCountInSection:indexPath.section];
|
|
|
- for (NSInteger i = indexPath.row + 1; i < item_count; i++) {
|
|
|
- item_key = [NSString stringWithFormat:@"item_%ld",i];
|
|
|
- NSDictionary *followed_item_json = [new_section_json objectForKey:item_key];
|
|
|
-
|
|
|
- item_key = [NSString stringWithFormat:@"item_%ld",i - 1];
|
|
|
- [new_section_json setObject:followed_item_json forKey:item_key];
|
|
|
+ for (NSInteger i = 0; i < item_count; i++) {
|
|
|
+ if (i == indexPath.row) {
|
|
|
+ if (i < item_count - 1) {
|
|
|
+ item_key = [NSString stringWithFormat:@"item_%ld",i + 1];
|
|
|
+ NSDictionary *followed_item_json = [new_section_json objectForKey:item_key];
|
|
|
+
|
|
|
+ item_key = [NSString stringWithFormat:@"item_%ld",i];
|
|
|
+ [new_section_json setObject:followed_item_json forKey:item_key];
|
|
|
+ } else {
|
|
|
+ item_key = [NSString stringWithFormat:@"item_%ld",i];
|
|
|
+ [new_section_json removeObjectForKey:item_key];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ [new_section_json setObject:@(item_count - 1) forKey:@"count"];
|
|
|
}
|
|
|
[new_cart_json setObject:new_section_json forKey:section_key];
|
|
|
|