Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS - How expensive is reloadData?

I as wondering how expensive reloadData on tableView is. I wanted to refresh the tableview every 5 seconds. Is that going to cause any performance issues?

like image 638
user1670024 Avatar asked Sep 13 '12 23:09

user1670024


1 Answers

Reload data will call the two main methods on your table view data source, numberOfRowsInSection and then iterate over cellForRow:atIndexPath: for the visible cells required, depending on your tableView's contentOffset

If your app scrolls nicely already then the only performance hit your app will endure is if you're doing a lot of work in numberOfRowsInSection (like hitting the network or something time consuming).

Edit: As noted, heightForRow:atIndexPath: can also be a pain point if you're using it to do complex calculations for different height cells.

like image 128
Jessedc Avatar answered Oct 15 '22 09:10

Jessedc