title: UINavigationBar that changes transparency when scrolling
body: <p>I am trying to implement <code>UINavigationBar</code> that changes its transparency when scrolling <code>UITableView</code>. At the beginning, the navigation bar should have transparent background, so the content below it should be visible (there will be an image displayed, for the example I am using solid color):</p>
  
  <p><img src="https://i.stack.imgur.com/X6Coj.png" alt="Example 1"></p>
  
  <p>When user scrolls table view, transparency should be replaced with solid color:</p>
  
  <p><img src="https://i.stack.imgur.com/BCuEX.png" alt="Example 2"></p>
  
  <p>Table view will contain section headers, that should act like when using non-translucent navigation bar. The header views should "stick" to navigation bar once they "touch" it from the bottom:</p>
  
  <p><img src="https://i.stack.imgur.com/gE5CI.png" alt="Example 3"></p>
  
  <p>I have no luck with trying to implement this flow in iOS app. </p>
  
  <p>For the initial state, I am setting <code>UINavigationBar</code> <code>translucent</code> property to <code>YES</code>, and both <code>backgroundColor</code> and <code>barTintColor</code> to clear color, which gives me what I want.</p>
  
  <p>Then, when user scrolls table view, I am updating the <code>backgroundColor</code> and <code>barTintColor</code> to a color with given alpha component, computed basing on current scroll offset. I am using <code>scrollViewDidScroll:</code> from <code>UIScrollViewDelegate</code> protocol to do so. However, it changes only the background of navigation bar, leaving status bar background transparent, which is not what I want.</p>
  
  <p>I can't find another way of making <code>UINavigationBar</code> transparent without setting <code>translucent</code> property to <code>YES</code>. Unfortunately, this changes how the section headers acts when scrolling. As navigation bar is translucent, section header views hides below it when they should "stick" to the bar like on third screenshot above.</p>
  
  <p>I would appreciate any help and hints how to achieve navigation bar that acts like described or similar in Objective-C or Swift.</p>