Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As for cell identifier- Instead of just using "cell" for the identifier, and instead of using a unique identifier like the OP, could you use a "type-identifier"? For example, if my table had 3 types of cells- one with a very complicated sub-layout, one with just <code>Style1</code>, and one with <code>Style2</code>, I should identify those three all separately and then just rebuild them if dequeue comes up <code>nil</code>.</p> <p>For example:</p> <pre><code>-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{ NSString* ident = @""; if(indexPath.section == 0) ident= @"complicated"; if(indexPath.section == 1) ident= @"style1"; if(indexPath.section == 2) ident = @"style2"; UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:ident]; if(cell == nil){ if(ident == @"complicated"){ cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:ident] autorelease]; // do excessive subview building } if(ident == @"style1"){ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyle1 reuseIdentifier:ident] autorelease]; } if(ident == @"style2"){ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyle2 reuseIdentifier:ident] autorelease]; } } if(ident == @"complicated"){ // change the text/etc (unique values) of our many subviews } if(ident == @"style1"){ [[cell textLabel] setText:@"Whatever"]; } if(ident == @"style2"){ [[cell textLabel] setText:@"Whateverelse"]; } return cell; } </code></pre> <p>(This code probably won't run because I wrote it here, but hopefully you get the idea. ) </p> <p>I don't think Apple would have created the whole reusable cell idea with identifiers if they wanted all the identifiers to be <code>"cell"</code>, don't you think?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload