title: UISearchController Search Bar Position Drops 64 points
body: <p>The search bar is appearing exactly 64 points too low: </p>
  
  <p><a href="https://i.stack.imgur.com/Qwqwm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qwqwm.png" alt="enter image description here"></a></p>
  
  <p>All of the other frames are exactly correct.</p>
  
  <p>Edit:
  - It's the <code>UISearchController</code>'s view that is getting the wrong <code>origin.y</code>. It gets set to 64, when it should be 0.
  If I add this method:</p>
  
  <pre><code>- (void)didPresentSearchController:(UISearchController *)searchController
  {
    [super didPresentSearchController:searchController];
    searchController.view.frame = CGRectMake(0, 0, searchController.view.frame.size.width, searchController.view.frame.size.height);
  
  }
  </code></pre>
  
  <p>Then the views align. However, its janky because it jumps. If I modify the frame in <code>willPresentSearchController</code> it does not work, as the controller must be doing some sort of layout after its presented.</p>
  
  <p>If I use SparkInspector, and edit the frame of the <code>UISearchBarContainerView</code> from origin 64 (what it gets set at, to 0), the problem is resolved.</p>
  
  <p>Here is my relevant configuration:</p>
  
  <pre><code>self.searchResultsController = [[GMSearchTableViewController alloc] init];
  self.definesPresentationContext = YES;
  self.searchController = [[UISearchController alloc] initWithSearchResultsController:self.searchResultsController];
  self.searchController.dimsBackgroundDuringPresentation = YES;
  self.searchController.hidesNavigationBarDuringPresentation = NO;
  self.searchController.searchBar.frame = CGRectMake(0, 0, self.view.frame.size.width, 44);
  [self.view addSubview:self.searchController.searchBar];
  </code></pre>
  
  <p>I'm not using Interface Builder, everything is configured in code.
  I'm positive that setting <code>definesPresentationContext</code> is correct.</p>
  
  <p>The VC sits in a regular <code>UINavigationController</code>, which is inside a SplitViewController (but problem exists on iPhone as well).</p>
  
  <p>I feel like I'm missing a simple configuration option in regards to the <code>UINavigationBar</code></p>
  
  <p>I also have a different controller that uses a custom Container View Controller model, which is more complex, and that one works.</p>
  
  <p>When I set </p>
  
  <pre><code>self.definesPresentationContext = NO;
  </code></pre>
  
  <p>This happens:
  <a href="https://i.stack.imgur.com/SEwa5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SEwa5.png" alt="enter image description here"></a></p>
  
  <p>So now the <code>UISearchBar</code> gets positioned correctly, but the presentation context is wrong, causing the <code>UISearchController</code>'s table view to occupy the full view.</p>