Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable cell reuse for small fixed-size UITableView

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).

like image 711
Sh'mu'el Cohen Avatar asked Jun 22 '11 16:06

Sh'mu'el Cohen


2 Answers

Set nil for reuse identifier in the line

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:nil]; 

Or just remove the line and add,

UITableViewCell *cell = nil; 
like image 117
EmptyStack Avatar answered Sep 19 '22 12:09

EmptyStack


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.

like image 33
Joe Avatar answered Sep 18 '22 12:09

Joe