Search code examples
iosobjective-cuitableviewparse-platformpfquery

Delete row in UITableView in conjunction with Parse


I am trying to delete a row in a UITableView (PFQueryTableViewController). The object deletes in the class, but is only reflected in the table when I refresh the table. Here is the code I am using.

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{
    return YES;
}


- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {


        PFObject *object = [self.objects objectAtIndex:indexPath.row];
        [object deleteInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {


            [tableView reloadData];
        }];
    }


}

Solution

  • Sussed it.

    Instead of [tableView reloadData], I've used [self loadObjects].

    However, the usual delete animation is not there.