I am using a UITableView to display custom content (by subclassing the UITableViewCell) and I have two types of content.
Type 1 that’s displayed normally consists of 6-7 rows and 1 section and this loads quite quickly no problem at all. This data set is displayed by default.
Now there’s a button on the view that when clicked will switch on a flag and called [tableview reloadData] and then the methods to provide the data will switch and starting returning this second set of data views…. there are about 20,000+ of these rows now… and there could be 1,000,000,000 (but that will not happen any time soon…).
All I do for this second type is store an integer (they’re not sequential – there are gaps so I have to do it this way) and then when ever the cellForRowAtIndexPath is called I return a cell and create a thread that will load up the data into that cell asynchronously. This works fine… but the problem is that when that button is clicked it takes a long time to switch over the content even though the table is not loading more than three components (their heights are quite big)…..
What is causing this long data reload time?…
Thank you.
I am going to assume that you correctly loading the data asynchronously and you are not trying to reload your 20,000+ objects into memory, you may want to double check. Otherwise if you are implementing
tableView:heightForRowAtIndexPath:to set the height of your rows this could be your issue. This delegate method needs to be called for each row so that it can set the scroll view content size. Instead use theUITableViewsrowHeightproperty.