Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are several problems.</p> <ol> <li><p><code>self.searchDisplayController</code> is <code>nil</code> because you haven't set that outlet in the Storyboard. Ctrl-drag from "Books Table View Controller" to "Search Display Controller" and select the "searchDisplayController" outlet.</p></li> <li><p>Your <code>filterContentForSearchText</code> method checks the value of <code>scope</code>, but that is <code>nil</code> because you have not defined any scopes in the seach bar.</p></li> <li><p><code>numberOfSectionsInTableView</code> should return <code>1</code> for the search results table view.</p></li> </ol> <p>If you fix these issues, you should be able to see some search results.</p> <p><strong>REMARK:</strong> This line</p> <pre><code>UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; </code></pre> <p>seems suspicious to me. You ask <code>self.tableView</code> to dequeue a cell even for the search results table view. I have seen this somewhere on SO as a method to use prototype cells with a search display, and it may be correct, but I have a small doubt.</p> <p><em>If it is correct</em>, then you don't need the following <code>if (nil == cell) { ... }</code>, because that method always returns a cell from the prototype.</p> <p>You should also note that inside the <code>if (nil == cell) { ... }</code> block you assign the value to a local variable <code>cell</code> instead of the variable from the outer scope. </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