NSDictionary *para = @{@"application":@"UnBindCardSign.Req",
@"userId":MBNonEmptyString([USER_DEFAULT objectForKey:kUserId]),
@"cardNo":MBNonEmptyString([_dataArray[indexDelete][@"cardNo"]delectSpace]),
@"cardType":MBNonEmptyString(_dataArray[indexDelete][@"accountType"])
};
[self.request requestWithDictionary:para completion:^(BOOL success, id responseData) {
if (success) {
//一定要先处理数据源 要不然崩溃
[_dataArray removeObjectAtIndex:indexDelete];
//删除行是deleteRowsAtIndexPaths方法
[_tableVIew deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:indexDelete inSection:0]] withRowAnimation:UITableViewRowAnimationFade];
[self showHud:@"解绑成功"];
}
}];
删除组是 deleteSections 方法, 如果用deleteRowsAtIndexPaths方法的话row设成0 Section:的值是正常取到的,其实还是会崩溃,
[_dataArray removeObjectAtIndex:indexDelete];
[_tableVIew deleteSections:[NSIndexSet indexSetWithIndex:indexDelete] withRowAnimation:UITableViewRowAnimationFade];
[self showHud:@"解绑成功"];