iPhone/Obj-C - Archiving object causes lag
Posted
by Dylan
on Stack Overflow
See other posts from Stack Overflow
or by Dylan
Published on 2010-05-24T22:17:51Z
Indexed on
2010/05/24
22:21 UTC
Read the original article
Hit count: 224
Hi I have a table view, and when I delete a cell I am removing an item from an NSMutableArray, archiving that array, and removing the cell.
However, when I do this, it is causing the delete button to lag after I click it. Is there any way to fix this?
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
int row = [indexPath row];
[savedGames removeObjectAtIndex:row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
//this line causing lag
[NSKeyedArchiver archiveRootObject:savedGames toFile:[self dataFilePath]];
}
}
Thanks
© Stack Overflow or respective owner