I have something weird with the repaint of my view controller. The view controller contains an UITableView and a spinner.
I have an updateFeed function
Here is my new answer for your editted question.
I don't know exactly what happens because usually, the table view will reload data and redraw the table view in separate thread that will not run that slow. Here is some guess that you can check:
1/ Check if you reuse the cell by cell identifier correctly
2/ Check if any other data source and delegate methods do heavy, networking job like in
* – tableView:cellForRowAtIndexPath: required method
* – numberOfSectionsInTableView:
* – tableView:numberOfRowsInSection: required method
or in:
# – tableView:heightForRowAtIndexPath:
# – tableView:indentationLevelForRowAtIndexPath:
# – tableView:willDisplayCell:forRowAtIndexPath:
I'm not sure what's causing your delay, but it smells like it could be a threading issue. Many UIKit classes aren't thread safe. As a general rule, you should try to make sure that all of your UI interaction happens on the main thread. In the code you originally posted, it looked like you were calling reloadData from your background thread, which seems risky. It's not clear to me which thread it's being called from now that you've changed your code.
Go through your doUpdate code path and make sure that any calls back to your delegate that could lead to a UI update are being done via performSelectorOnMainThread:
.