更新时间:2023-11-18 19:45:34
Update the data model according to edit actions delete using bellow code.
This bellow code is just an example for hot to delete or remove the object from array and also from table .. for more info check the tutorial which i post the link bellow..
- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
[arryData removeObjectAtIndex:indexPath.row];
[tblSimpleTable reloadData];
}
}
or also using this bellow logic with custom button of cell...
- (IBAction)deleteCustomCellWithUIButton:(id)sender
{
NSIndexPath *indexPath = [yourTableView indexPathForCell:(UITableViewCell *)[[[sender superview] superview] superview]];
NSUInteger row = [indexPath row];
[yourTableView removeObjectAtIndex:row];
[yourTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
For more info refer these tutorial...