didSelectRowAtIndexPath
你是要怎么個刪除法。是要實現(xiàn)滑動cell出現(xiàn)刪除按鈕,然后點擊刪除养渴? 還是什么。泛烙。
//按鈕顯示的內(nèi)容
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
? ?return @"刪除";
}
//這里就是點擊刪除執(zhí)行的方法
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
}
1.如果你的數(shù)據(jù)是從服務器獲取的厚脉,那就直接調(diào)用接口,重新獲取數(shù)據(jù)源 再
[tableView reloadData]; 就行
2.如果只想修改本地數(shù)據(jù)
[_data removeObjectAtIndex:[indexPath row]]; ?//刪除_data數(shù)組里的數(shù)據(jù)
[tableview deleteRowsAtIndexPaths:[NSMutableArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; ?//刪除對應數(shù)據(jù)的cell