Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the UITableView "beginUpdates" and UICollectionView "performBatchUpdates" have the same behavior?

I was browsing the documentations, when I started wondering if "beginUpdates" in a UITableView and "performBatchUpdates" in a UICollectionView have the same behavior. If so, is there a reason, that they're called differently, even though they're virtually the same thing?

Thanks!

like image 605
Zoyt Avatar asked Aug 04 '14 18:08

Zoyt


1 Answers

UITableView's beginUpdates must be matched with a call to endUpdates. UICollectionView's performBatchUpdates:completion method does not require you to call back to the collection view when you are doing with the updates, presumably because the block of work that you pass in to update the collection view is wrapped with those calls for you.

UITableView predates blocks being added to Objective-C. I suspect the reason there isn't a similar API for UITableView is that its public API was designed before blocks could be incorporated.

like image 133
Jeff Holliday Avatar answered Oct 05 '22 00:10

Jeff Holliday