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.

有帮助吗?

解决方案 2

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

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top