title: Hiding Nav Bar moves view "up"
body: <p>The usual story -- I'm making an iOS 5/6 app run under iOS 7 and the navigation bar behavior change is causing a problem.  </p>
  
  <p>The app already worked like the iOS 7 default with a full-screen view and a translucent nav bar "over" of the view.  The problem is that hiding/un-hiding the nav bar causes different behavior in iOS 7.  On iOS 5/6 hiding/un-hiding the nav bar does not change the view.  On iOS 7, hiding the bar visually moves the view up leaving a blank bar at the bottom of the screen and un-hiding the bar moves the view back down to occupy the full screen (with the nav bar on top, of course).</p>
  
  <p>I need to continue to support iOS 5 so I don't use auto layout, but I do use the full screen.
  I have a view in which I'm viewing a zoomable image -- so the view controller has a fullscreen view containing a scrollView which contains an imageView.</p>
  
  <p>The status bar is always hidden.</p>
  
  <p>I get to the view controller via a navigation controller so there is a (black, translucent) navigation bar which lies over the top of my fullscreen view/scrollView/imageView.</p>
  
  <p>After a brief delay some overlaying labels fade and the navigation bar is hidden
  A single tap restores the overlay labels and un-hides the navigation bar.
  This works on iOS 5/6 -- the navigation bar slides off the top of the screen uncovering the top of the view/image.</p>
  
  <p>On iOS 7, when the navigation bar slides off the top of the screen the entire view visually moves up a corresponding amount (i.e. 44 points) leaving a black bar at the bottom of the screen.  I can see this by setting a background color on the top-level view and resizing the scrollview enough to see the background; the top of the view does indeed move offscreen and the background color is not drawn over the bottom (44 points) of the screen.</p>
  
  <p>BUT, self.view.frame doesn't change and remains at {0, 0} 320 x height.</p>
  
  <p>When I single-tap to restore the overlay info and navigation bar the view moves back down to occupy the full screen and the translucent nav bar is over the top of the view/image.</p>
  
  <p>Nothing I've tried changes the behavior:
  Changing the IB view controller layout controls (Under top bars, Under bottom bars, Adjust scroll view insets). Building for 5.1, 6.1, and 7.0 all produce the same result when run under 7.0.</p>
  
  <pre><code>self.edgesForExtendedLayout = UIRectEdgeNone
  </code></pre>
  
  <p>does nothing.  Using the layout delta values doesn't do anything.  In IB the view looks the same when "viewed as" iOS 7 and iOS 6 and earlier.  I print out a lot of debug info but nothing about the view (or scroll view) seems to change when the view moves "off screen".</p>
  
  <p>The code that shows the overlay info (run when the view is first shown and on single-taps) is:</p>
  
  <pre><code>- (void) showOverlayInfo {
      self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
      [[[self navigationController] navigationBar] setTranslucent:YES];
      [[self navigationController] setNavigationBarHidden:NO animated:NO];    
  
      overlayInfoHidden = NO;
      overlayInfoFading = NO;
      self.infoButton.hidden = NO;
      self.infoButton.alpha = 1;
      self.descriptionLabel.hidden = NO;
      self.descriptionLabel.alpha = 1;
  }
  </code></pre>
  
  <p>The code that hides the overlay info is:</p>
  
  <pre><code>- (void) hideOverlayInfo {
      overlayInfoHidden = YES;
      overlayInfoFading = NO;
      self.infoButton.hidden = YES;
      self.descriptionLabel.hidden = YES;
      [[self navigationController] setNavigationBarHidden:YES animated:YES];
  }
  </code></pre>
  
  <p>So can anybody tell me what (presumably simple) thing I'm missing?</p>