Le rechargement d'un seul UITableViewCell sur un UITableview

Ok les Gars, voici la situation que j'ai.

Je suis en utilisant un UITableViewController avec la Base de Données. La table dispose d'environ 200 cellules, que, fondamentalement, la fonction d'une liste de contrôle. Lorsque vous appuyez sur une cellule, la cellule a une case à cocher qui obtient basculé ensemble de la UITableViewCell.imageView ( le UIImageView affecté à la gauche de l'étiquette).

À chaque fois que je utiliser l'une des deux manières ci-dessous pour mettre à jour la table, il faut environ 1 à 2 secondes pour la mise à jour ... et à partir de ce que je peux dire, il semble être le rechargement de chaque cellule. Comment puis-je la force que la cellule qui vient d'être choisi pour être mis à jour?

[self.tableView reloadData]; ou

- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {
[self.tableView beginUpdates];
}
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo
atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type {
switch(type) {
case NSFetchedResultsChangeInsert:
[self.tableView insertSections:[NSIndexSet indexSetWithIndex:sectionIndex]
withRowAnimation:NO];
break;
case NSFetchedResultsChangeDelete:
[self.tableView deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex]
withRowAnimation:NO];
break;
}
}
- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject
atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type
newIndexPath:(NSIndexPath *)newIndexPath {
UITableView *tableView = self.tableView;
switch(type) {
case NSFetchedResultsChangeInsert:
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath]
withRowAnimation:NO];
break;
case NSFetchedResultsChangeDelete:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:NO];
break;
case NSFetchedResultsChangeUpdate:
[self configureCell:[tableView cellForRowAtIndexPath:indexPath]
atIndexPath:indexPath];
break;
case NSFetchedResultsChangeMove:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:NO];
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath]
withRowAnimation:NO];
break;
}
}
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
[self.tableView endUpdates];
}
  • Comment voulez-vous mettre à jour les données dans le modèle? Cela ressemble à toutes les cellules de la mise à jour.
  • le deuxième paramètre de -insertSections:withRowAnimation:, -deleteSections:withRowAnimation:, -insertRowsAtIndexPaths:withRowAnimation:, et -deleteRowsAtIndexPaths:withRowAnimation: ne sont pas BOOL; ils sont un UITableViewRowAnimation type
InformationsquelleAutor Travis | 2010-08-14