Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>you already set images hide for your Index-Path.row like:-</p> <p>For example Section One you set <code>if (indexPath.row==1) { [[cell imageView] setHidden:YES];}</code> as same as <code>if (indexPath.row==2)</code> that's why your section one display only First 0th index row image Appear other not displaying.</p> <pre><code>case 0: if (indexPath.row==0) { [[cell imageView] setHidden:NO]; } else{ [[cell imageView] setHidden:YES]; } </code></pre> <p><strong>just replace your <code>cellForRowAtIndexPath</code> code with my bellow <code>cellForRowAtIndexPath</code> method</strong></p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *CellIdentifier = [NSString stringWithFormat:@"%d_%d",indexPath.section,indexPath.row]; //uniq identifire for each section with it's row UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } switch (indexPath.section) { case 0: cell.textLabel.text = [items objectAtIndex:indexPath.row]; cell.imageView.image = [UIImage imageNamed:@"Star.jpg"]; if (indexPath.row==0) { [[cell imageView] setHidden:NO]; } else { [[cell imageView] setHidden:YES]; } break; case 1: cell.textLabel.text = [items objectAtIndex:indexPath.row]; cell.imageView.image = [UIImage imageNamed:@"Star.jpg"]; if (indexPath.row==0) { [[cell imageView] setHidden:NO]; } else { [[cell imageView] setHidden:YES]; } break; case 2: cell.textLabel.text = [items objectAtIndex:indexPath.row]; cell.imageView.image = [UIImage imageNamed:@"Star.jpg"]; if (indexPath.row==0) { [[cell imageView] setHidden:NO]; } else { [[cell imageView] setHidden:YES]; } break; case 3: cell.textLabel.text = [items objectAtIndex:indexPath.row]; cell.imageView.image = [UIImage imageNamed:@"Star.jpg"]; if (indexPath.row==0) { [[cell imageView] setHidden:NO]; } else { [[cell imageView] setHidden:YES]; } break; case 4: cell.textLabel.text = [items objectAtIndex:indexPath.row]; cell.imageView.image = [UIImage imageNamed:@"Star.jpg"]; if (indexPath.row==0) { [[cell imageView] setHidden:NO]; } else { [[cell imageView] setHidden:YES]; } break; case 5: cell.textLabel.text = [items objectAtIndex:indexPath.row]; cell.imageView.image = [UIImage imageNamed:@"Star.jpg"]; if (indexPath.row==0) { [[cell imageView] setHidden:NO]; } else { [[cell imageView] setHidden:YES]; } break; default: break; } return cell; //} } </code></pre> <p>create CellIdentifier like this:-</p> <pre><code> NSString *CellIdentifier = [NSString stringWithFormat:@"%d_%d",indexPath.section,indexPath.row]; //uniq identifire for each section with it's row </code></pre>
 

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