Home > Mobile >  UItableView custom title reuse problems
UItableView custom title reuse problems

Time:09-24

I found UITableViewHeaderFooterView reuse must be based on at least there is a set of rows of data, without the execution
 [self tableView reloadData]; 

Or
 [self tableView reloadSections: [NSIndexSet indexSetWithIndex: headView. Tag] withRowAnimation: UITableViewRowAnimationAutomatic]; 

With the graph is:

This scrolling list when the picture or the rest of a closed group, can achieve the result that don't create new headerView,

As shown in figure, there is no in creating new headerView print information,
And if it is below this kind of all groups are closed (not displayed a line of cell) :

Scroll tableView when open or close a group will console to print the following information:

As shown in figure can see headView didn't achieve the result of reuse.
Finally can draw the conclusion:
UITableViewHeaderFooterView reuse must be based on a UITableView display at least one cell,

CodePudding user response:

't look problem too long, but I can share with you my understanding of UITableView reuse mechanism.
For example, the cell apple encapsulates two set collection, one is set in used. A free set. When a cell to display, take an object from the set of idle, if not, then create a new one, and put new objects in the working set, when the tableview reload, would the set of all objects are using mobile to set free, and then display. Probably the reuse process is like this. Hope for your help. Interaction Q: 2224080408

CodePudding user response:

If have no effect on performance, not stick to one pattern,

CodePudding user response:

1. If you registered before reuse reuse,
2 footer header usage without cell so big, even if they don't reuse, in today's mobile phone configuration, is rarely consumed, unless you get the header footer when the cell to use,
  •  Tags:  
  • iOS
  • Related