是 - [UITableView reloadData]异步还是同步? [英] Is -[UITableView reloadData] asynchronous or synchronous?
问题描述
当在表视图实例上调用 -reloadData
时,是否使所有 UITableViewDataSource
调用async?
谢谢。
When you call -reloadData
on a table view instance, does it make all UITableViewDataSource
calls async?
Thank you.
推荐答案
此方法实际上只是删除所有 UITableViewCell
从表中查看。
This method actually just removes all the UITableViewCell
views from the table. The data source delegate methods are called when the table is repainted.
因此,它是异步的。
编辑:
实际上,一些呼叫是同步的。段数目行和行高立即更新,因此,例如 contentSize
在调用后正确设置。另一方面, tableView:cellForRowAtIndex:
在重绘之前不会被调用。
Actually, some calls ARE synchronous. The number of sections & rows and row heights are updated immediately, so, for example contentSize
is set correctly after the call. On the other hand, tableView:cellForRowAtIndex:
is not called until the table is repainted.
这篇关于是 - [UITableView reloadData]异步还是同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!