I’ve been working recently on a table with section headers that had really slow scrolling speeds (around 30 FPS). After a lot of digging, I found the problem in a strange place, so I thought I would share in hopes that someone else can save some time.
The gist of the problem is that when you override tableView:viewForHeaderInSection: it ends up being called constantly when you scroll. This in turn calls tableView:titleForHeaderInSection, and if that’s slow, you’re going to see serious lag.
What can unexpectedly make that call slow, however, is the standard:
[[[UILocalizedIndexedCollation currentCollation] sectionTitles] objectAtIndex:section];
What dramatically speeds it up, however, is declaring your own NSArray *sectionHeaders and setting it in your init as so:
sectionTitles = [[[UILocalizedIndexedCollation currentCollation] sectionTitles] copy];
I found that referencing this instead of the indexed collation dramatically sped up my scrolling speed, and now I’m whisking along at an acceptable speed (60 FPS).