Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableViewCells not appearing initially
    primarykey
    data
    text
    <p>I have three UITableViews that should look identical. Each is placed inside a different subview of a UIScrollView. As I scroll, I can see each table. The first table appears perfectly. However, only the background color shows for the second and third tables.</p> <p>tableView:cellForRowAtIndexPath: is being called for every row for each table, where I insert a subview into the cell's contentView. The subview has already been created before this method is called and is reused across the three tables for a given row (in an attempt to make tables look identical).</p> <p>I made two interesting discoveries:</p> <ul> <li>Although the cell doesn't show initially, it will appear after scrolling to hide the row and then show it again.</li> <li>When the cell appears after scrolling, it has been moved from another table. It no longer appears in the table where it had been showing.</li> </ul> <p>Here's my code:</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"PlotCellID"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"PlotCell" owner:self options:nil]; if ([nib count] &gt; 0) cell = self.plotCell; else NSLog(@"Failed to load AlertCell nib!"); } // Set up the cell... NSUInteger row = [indexPath row]; AppDelegate *del = (AppDelegate *)[[UIApplication sharedApplication] delegate]; ResultSet *rs = del.resultPlots; CPTGraphHostingView *cellPlotView = [rs.hostingViews objectAtIndex:row]; cellPlotView.frame = cell.contentView.bounds; cellPlotView.autoresizingMask = UIViewAutoresizingFlexibleWidth; [cell.contentView insertSubview:cellPlotView atIndex:0]; return cell; } </code></pre> <p>cellPlotView refers to the subview already created.</p> <p>Any idea how to fix this so I can see all my tables correctly showing as I scroll? It's as if the cells can't reuse content. Thanks.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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