Does the UITableView “beginUpdates” and UICollectionView “performBatchUpdates” have the same behavior?

别来无恙 提交于 2019-12-23 06:51:09

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/25125601/does-the-uitableview-beginupdates-and-uicollectionview-performbatchupdates-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!