Hide search bar of search display controller
<p>I dragged a search bar and display controller to a view controller and placed it at the bottom of the outline.</p>

<p>I then set it to display in navigation bar with following line in viewdidload.  All that works.</p>

<pre><code>self.searchDisplayController.displaysSearchBarInNavigationBar = true;
</code></pre>

<p>However, I want to hide it initially, and the following line in vewdidload is not having any effect.</p>

<pre><code>self.searchDisplayController.searchBar.hidden = true;
</code></pre>

<p>Can anyone suggest what to do?</p>

<p>Thanks in advance for any suggestions.</p>

<p>EDIT:</p>

<p>I think I have figured out that you cannot have searchBar.hidden = true and displaysSearchBarInNavigationBar at the same time.  Which is fine by me as I only want one or the other.  So I tried separating the two cases.  </p>

<p>First in view did load, I put </p>

<pre><code>self.searchDisplayController.searchBar.hidden = true;
</code></pre>

<p>This does work if by itself.</p>

<p>Then I have a search button wired to an action method as follows:</p>

<pre><code> - (IBAction)searchButtonPressed:(id)sender {
    NSLog(@"search button pressed");
    self.searchDisplayController.searchBar.hidden = false;
    self.searchDisplayController.displaysSearchBarInNavigationBar = true;
    self.searchDisplayController.searchBar.showsCancelButton = YES;
}
</code></pre>

<p>However, while I can see from the log that the method is called, it does not unhide the search bar.  Perhaps it is delegate issue but still looking for solutions.</p>