I have many threads calling UITableView's reloadData method concurrently. Do I actually have to put a @synchronized block around it?
Asked
Active
Viewed 872 times
2 Answers
5
reloadData
, like any other method on a view, should only be called from the main thread only. So you don't need @synchronized
because only one thread should be there at a time.
If you're on a background thread and you want the table view to reload, use dispatch_async
to make sure the reload happens on the main thread:
dispatch_async(dispatch_get_main_queue(), ^{
[myTableView reloadData];
});

benzado
- 82,288
- 22
- 110
- 138
5
You shouldn't call reloadData from threads other than the main thread.
See this similar question:
iOS - another thread needs to send reloadData to the mainthread