Here is a handy post in which the author provides some source code for performing animations in the currently selected cell:
http://iphonedevelopment.blogspot.com/2010/01/navigation-based-core-data-application.html
It uses this in the context of NSFetchedResultsController, but you can see how it uses various calls to add / remove cells and sections.
Now, in your case, you will need to modify any array that you use to place the data used to create the rows in the View table when you βactivateβ your cell, and then selectively use:
- Tableview: insertRowsAtIndexPaths: withRowAnimation:
- Tableview: deleteRowsAtIndexPaths: withRowAnimation:
- Tableview: insertSections: withRowAnimation:
- Tableview: deleteSections: withRowAnimation:
to set it up correctly (you can start with tableView: reloadData :, but this is inefficient).
I understand that the API may be a little more complicated, but take the time to read it and understand what the various calls make. Understanding how the UITableView uses its data source and delegate, as well as the chain of events that occur when cells are selected / deleted / etc., are Important if you want to get everything in order (and without crashing).
David carney
source share