title: Strange UISearchDisplayController view offset behavior in iOS 7 when embedded in navigation bar
body: <p>I am building an iOS 7-only app. I am trying to set a UISearchDisplayController into the navigation bar.</p>
  
  <p>I have it set up like this:  In the storyboard, I added a "Search Bar and Search Display Controller" to my view controller's view, and set it at (0,0) relative to the top layout guide.  I set constraints to pin to left, top and right. (I played with the constraints, i removed them completely, it doesn't matter) On top of that I have my Table view.   When I added the search bar to the view in the storyboard, it automatically setup outlets for searchDisplayController and searchBar delegate. In code I have <code>self.searchDisplayController.displaysSearchBarInNavigationBar = YES;</code> I have two problems:</p>
  
  <p>1) Without any buttons showing for the search bar (Interface builder -> select search bar -> Options: none selected) the search bar is in the middle of the screen:</p>
  
  <p><img src="https://i.stack.imgur.com/wZ9Zi.png" alt="enter image description here"></p>
  
  <p>If I click on the navigation bar, it starts editing the search bar:</p>
  
  <p><img src="https://i.stack.imgur.com/xr2Z4.png" alt="enter image description here"></p>
  
  <p>notice also that the dark overlay appears to be offset from the navigation bar.  It seems to me that the space is the same height as the navigation bar.  Like it has been shifted down by that much.  Also, when it displays the search results, the top of the content view is shifted down by the same amount (more pictures follow), which brings me to the second problem.</p>
  
  <p>2) I messed around with it for a while and decided to check the option to have it show the cancel button.  Now I have the search bar embedded in the nav bar correctly, but the overlay is still shifted down:</p>
  
  <p><img src="https://i.stack.imgur.com/QbQqf.png" alt="enter image description here"></p>
  
  <p>Again, when the search results table view appears, it is shifted down by the same amount (notice the scroll bar on the right side):</p>
  
  <p><img src="https://i.stack.imgur.com/h0gKq.png" alt="enter image description here"></p>
  
  <p>Even more bizarrely, I set a border on the search display controller's tableview layer, and it appears correct:</p>
  
  <p><img src="https://i.stack.imgur.com/gJnRY.png" alt="enter image description here"></p>
  
  <p>I have never used the UISearchDisplayController before and I unfamiliar with how to set it up, but functionally it works fine.  I have read some other similar posts but the only advice is to hack it up by adjusting frames and setting manual offsets.  I'd prefer to know what is causing this, is it a bug?  Something I'm doing wrong?  If it's a bug I can wait for a fix.  It seems like such a basic thing that a thousand people must have done without any problem so I feel like I'm not setting it up correctly somehow.  Thanks for you input.</p>