Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try moving <code>[_tableView reloadData]</code> to <code>viewWillAppear</code>.</p> <p><a href="http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40007523" rel="nofollow">UITableViewController</a> reloads the table view's data in <code>viewWillAppear</code>, not <code>viewDidLoad</code>. I can't tell you the exact reason for which this would make a difference, though I can think of several. Anyway, it's worth a try.</p> <p>EDIT:<br> RESPONSE TO COMMENTS</p> <ol> <li><p>If <code>titleForHeaderInSection:</code> is being called, then there is a data source connected to a table view. So, the problem is not a lack of a data source connection. </p></li> <li><p>I am guessing you have 2 table views in your .xib file: a large one &amp; a short one below it. The large table view is not connected to the data source, so it just displays blank lines. The short table view <em>is</em> connected to the data source. But, it is just tall enough for a header and has no space left to display any cells. Thus, <code>titleForHeaderInSection:</code> is called, but <code>cellForRowAtIndexPath:</code> is not because there is no space to display any cells.<br> Note that this is just a guess, but it is the only scenario I can think of that would cause the behavior you described. The code you posted looks ok, although a bit more complicated than necessary.</p></li> <li><p>There is no question that <code>reloadData</code> should be in <code>viewWillAppear</code>. That's where the Apple engineers put it when they created the UITableViewController class. So, to put it elsewhere, you have to believe you know better than they do.</p></li> </ol>
 

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