title: Programmatically scrolling on iOS 11 with UISearchController's search bar not disappearing
body: <p>On iOS 11, where the search bar for is able/recommend to be attached to the navigation controller with <code>navigationItem.searchController = searchController</code>, animating a <code>contentOffset</code> change seems a little buggy, as the search bar seems to often stay in place. Immediately scrolling afterward fixes it, but it's ugly to see.</p>
  
  <p>If you scroll all the way to the top by tapping the status bar (causing the search bar to be visible), and then animate a <code>contentOffset</code> change on the <code>UIScrollView</code>, you can see the search bar sticking around sometimes, specifically on device rather than simulator (but you can still see on simulator that the nav bar is too tall):</p>
  
  <p><a href="https://i.stack.imgur.com/KDd4B.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KDd4B.png" alt="enter image description here"></a></p>
  
  <p>This can be observed very easily with even one of Xcode's template projects, such as "Master Detail", by adding a search controller and then adding a button to jump back up.</p>
  
  <pre class="lang-swift prettyprint-override"><code>@objc func goBackUp(_ sender: Any) {
      tableView.setContentOffset(CGPoint(x: 0.0, y: 1200), animated: true)
  }
  </code></pre>
  
  <p>Here's an example project showing that: <a href="https://drive.google.com/file/d/15ZzAMgSlvKdb7FJWNzjNGv712-Ci59Oj/view?usp=sharing" rel="nofollow noreferrer"><strong>Sample Project</strong></a></p>
  
  <p>I'm aware this is most likely an iOS bug as there's no issue on iOS 10 and earlier, but does anyone know of a fix in the meantime?</p>