Search code examples
iosobjective-cuitableviewios5ios6

If I only need 1 UITableViewCell, can I create it without using a reuse identifier and all that stuff?


In the cellAtIndexPath method, could I just do something like:

UITableViewCell *cell = [[UITableViewCell alloc] init];
UILabel *label = // make label
[cell addSubview:label];

return cell;

Is that possible, or something similar?


Solution

  • Sure, that code will work for your situation.

    It would also work for a 10,000 row table view, but you would sacrifice the performance enhancements that the table view uses, like cell reuse. Using a 10k cell TV without caching would result in an unusable experience.