Disable cell reuse for small fixed
I have a small, fixed-size table, and I want to load UITableView entirely into memory, and never reuse cells if they scroll out of view. How do I achieve this?
I'm not using a UITableViewController; just a simple UIViewController that implements the proper protocols (UITableViewDataSource and UITableViewDelegate).
Set nil
for reuse identifier in the line
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:nil];
Or just remove the line and add,
UITableViewCell *cell = nil;
Just do not implement the method UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SomeID"];
and none of your cells will be reused. Each time it ask for a cell you create a new one and configure it.
You should pass nil
in the method initWithStyle:reuseIdentifier:
if you don't want to reuse cells but keep in mind the performance. As long as it is good, you should be ok passing nil
.
上一篇: 在没有UITableViewController的情况下刷新UITableView
下一篇: 禁用小固定的小区重用