Animating TableView Instead of Plain Reloading
I am trying to animate the reloading of a tab开发者_运维知识库le view. Currently, I download the array of table view items and if the user reloads the table view manually, it downloads into a separate array, compares the current to the newly downloaded, and if they are different, it reloads the table view with the newly downloaded array. Is there an easy way to, somehow, compare the arrays and insert/delete rows (animated, of course) accordingly?
I found the Apple's Table View Programming Guide to be very useful for this question:
http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/TableView_iPhone/ManageInsertDeleteRow/ManageInsertDeleteRow.html
If you are using arrays, you would need to deal with figuring out inserted/deleted rows. If you are dealing with a larget set of data, then you should consider using Core Data with NSFetchedResultsController
. See documentation for NSFetchedResultsControllerDelegate for getting inserted/deleted rows.
精彩评论