Note that there are some explanatory texts on larger screens.

plurals
  1. POerror creating custom tableview separator
    text
    copied!<p>I'm trying to create a tableview with custom separator. I made a custom Cell that holds the content, and another that contains only a UIImageView with the separator. The problem is in how content is being accessed. I can not use the indexPath.row</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CustomCell *cell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier: @"CustomCell"]; if(cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil] objectAtIndex:0]; } SeparatorCell *cellSeparator = (SeparatorCell *) [tableView dequeueReusableCellWithIdentifier: @"SeparatorCell"]; if(cellSeparator == nil) { cellSeparator = [[[NSBundle mainBundle] loadNibNamed:@"SeparatorCell" owner:self options:nil] objectAtIndex:0]; } if(indexPath.row % 2) { UIFont * myCustomFont = [UIFont fontWithName:@"Arial Black" size:16]; [cell.titulo setFont:myCustomFont]; cell.titulo.textColor = [UIColor colorWithRed:103/255.0f green:169/255.0f blue:0/255.0f alpha:1]; cell.titulo.text = [Title objectAtIndex:myRow]; cell.subtitle.text = [Subtitle objectAtIndex:myRow]; cell.tag = myRow; myRow++; } else [cellSeparator.imagem setImage:[UIImage imageNamed:@"CustomSeparator.png"]]; if(indexPath.row % 2) return cell; else return cellSeparator; } </code></pre> <blockquote> <p>myRow</p> </blockquote> <p>is a global NSInteger. </p> <p>I already tried</p> <pre><code>if(myRow == Title.count) myRow=0; else myRow++; </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