Note that there are some explanatory texts on larger screens.

plurals
  1. POStoryboard static cells: dequeueReusableCellWithIdentifier returns nil
    text
    copied!<p>Using storyboard, static cells, in <code>cellForRowAtIndexPath:</code> the line</p> <pre><code>UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; </code></pre> <p>always returns <code>nil</code>. </p> <p>I have checked the following: </p> <ul> <li>Identifier of the cell is correctly set in IB/Storyboard and I use the same identifier in code. I verified this many times.</li> <li>I have not instantiated the view controller elsewhere (which was the problem in <a href="https://stackoverflow.com/questions/9797821/keep-getting-nil-from-dequeuereusablecellwithidentifier">this stackoverflow question</a>). </li> </ul> <p>My view controller is a subclass of <code>UITableViewController</code>, of course, wrapped into an <em>ad hoc</em> navigation controller in storyboard. Suspecting that my view controller somehow does not know about the cell identifiers defined in storyboard because it might be another instance, here is the code the "instantiates" it. In <code>prepareForSegue:</code>, I use</p> <pre><code>CustomViewController *vc = [[[segue destinationViewController] viewControllers] objectAtIndex:0]; </code></pre> <p>Other customizations of the view controller done here (setting properties etc.) works fine.</p> <p>I am using static cells because the number of sections and rows does not change, and each cell contains static text (and other controls or text fields to be edited). </p> <p>It seems to me this is a very common task (customize static cells from storyboard in the view controller's datasource methods). What am I doing wrong?</p>
 

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