iphone - How to implement delayed/batched table view update from NSFetchedResultsControllerDelegate? -


You should carefully consider whether you want to update table view Because every change is made. If a large number of modifications are made simultaneously - for example, if you are reading data from the background thread - /.../ you can simply implement the controller deed change content: (which is processed on all pending changes Once done, send it to the delegate. See the table reload.

This is what I am doing: mergeChangesFromContextDidSaveNotification: I am processing changes in the background thread with a different managed object syntax in a different pouch MOC. So far so good.

I did not apply the controller: didChangeObject: ... and instead suggested to update the document.

Question / Problem: Does the document not really expand to implement batch updates? Should I just call [tableview reloadData] in the controller DidChangeContent: or is there a less intrusive way to prevent me from completely reloading?

One thought that: I could take the notes of the merger from the Changes ... Notification in which the converted objects, understand their indexpath, and just call the television: ReloaderAndAndepath: For them. But are there any official information, recommendations or examples? Or just [tableview reloadData]?

(On one side: Controller: didChangeObject: ... actually started behaving inappropriately, when it got a set of systematic updates, even though the same update code [I now put it in the background Given thread] when it was running on the main thread, but of course it was OK before locking the UI.)

I just used the reloadData in controllerDead Change Content: .

To call, Apple Boiler Plate Code (iOS SDK 4.3.x) looks like this:

  - (zero) Controller Specially Contracts: (NSFatted Publisher Control * ) Controller {[self.tableView startupdates]; } - (Zero) Controller: (NSFATed Result Controller *) Administrator Changes: (id & lt; NSFetchedResultsSectionInfo & gt;) section Infant On Index: (NSUntiger) section Index for Change Type: (NSFetchedResultsChangeType) Type {Switch (Type ) {Case NSFetchedResultsChangeInsert: [self.tableView insertSections: [NSIndexset Index with Index: Section Index] Row Animation: UITDViewAvitation Phad]; break; Case NSFetchedResultsChangeDelete: [delete self.tableViewSign: [NSIndexSet indexSetSoundX: section index] withRowAnimation: UITableViewRowAnimationFade]; break; }} - (Zero) Controller: (NSFetchedResultsController *) Administrator didCangeObject: (id) anObject atIndexPath: (NSIndexPath *) index for package type: (NSFetchedResultsChangeType) type newIndexPath: (NSIndexPath *) newIndexPath {UITableView * tableView = self.tableView; Switch (type) {case NSFetchedResultsChangeInsert: [tableView insertRowsAtIndexPaths: [NSArray arrayWithObject: newIndexPath] withRowAnimation: UITableViewRowAnimationFade; break; Case NSFetchedResultsChangeDelete: [tableView deleteRowsAtIndexPaths: [NSArray arrayWithObject: indexPath] with Row Animation: UITableViewRowAnimationFade]; break; Case NSFetchedResultsChangeUpdate: [Self Configure Cell: [tableView cellForRowAtIndexPath: Index Path] atIndexPath: indexPath]; break; Case NSFetchedResultsChangeMove: [tableView deleteRowsAtIndexPaths: [NSArray arrayWithObject: indexPath] with Ryan Animation: UITableViewRowAnimationFade]; [Add tableviewRATI and XPPath: [NSARRAAR with object: New IndexPath] with Row Animation: UITDViewAnimationFed]; break; }} - (Zero) ControlDeadDead Resource: (NSFetchedResultsController *) controller {[self.tableView endUpdates]; }  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -