Question

I have a UITableView with a lot of rows and a lot of sections (over 500 sections). Having a lot of rows is not so bad, because only the visible rows are loaded using the dequeueReusableCellWithIdentifier method. The problem is that ALL of the section headers are loaded each time i perform [tableView reloadData].

Is there a way to use dequeued section headers the same way i use it for rows?

If not, the only two options i can think of is:

  1. handling the section header queue my self.
  2. Making the section headers to be custom cells and managing the section-cell mapping my self.

Both solutions are very complicated because i use NSFetchedResultsController.

Was it helpful?

Solution 2

Fortunately for my acceptance rate - this issue was solved in iOS6 with: UITableView's dequeueReusableHeaderFooterViewWithIdentifier method.

OTHER TIPS

If you are sure that all the section headers are loaded each time*, it means it's a system behavior.

What is complicated by using a NSFetchedResultsController ? If if really is, maybe you should write your own UITableViewDelegate/DataSource to have more flexibility.

*i.e. that

 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

or

 - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

are called X times when you send the [tableView reloadData] message.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top