The usual story. I am running an iOS 5/6 application running iOS 7, and changing the behavior of the navigation bar is causing a problem.
The application already works as iOS 7 by default with a full-screen view and a translucent above navigation bar. The problem is that hiding / hiding the navigation bar causes a different behavior in iOS 7. On iOS 5/6, hiding / hiding the navigation bar does not change the look. On iOS 7, hiding the panel visually moves the view up, leaving a blank panel at the bottom of the screen, and not hiding the bar, moves the view back to occupy the entire screen (of course, with the navigation bar at the top).
I need to continue to support iOS 5, so I do not use automatic layout, but I use full screen. I have a view in which I am viewing a scalable image, so the view controller has a full-screen view containing a scrollView that contains the image.
The status bar is always hidden.
I get to the view controller using the navigation controller, so there is a (black, translucent) navigation bar that sits on top of the top of the full screen view / scrollView / imageView.
After a short delay, some overlapping marks disappear and the navigation bar is hidden. One tap restores overlay marks and does not hide the navigation bar. This works on iOS 5/6 - the navigation bar slides at the top of the screen, revealing the top of the view / image.
In iOS 7, when the navigation bar moves from the top of the screen, the whole view visually moves to the appropriate size (i.e., 44 points), leaving a black bar at the bottom of the screen. I see this by setting the background color in the top-level view and resizing the scroll enough to see the background; the upper part of the view really moves behind the scenes, and the background color is not drawn above the bottom (44 points) of the screen.
BUT, self.view.frame does not change and remains at a height of {0, 0} 320 x.
When you press once to restore overlap information and the navigation bar, the view moves back to fill the full screen, and the translucent navigation bar is above the top of the view / image.
Nothing I tried changes the behavior: Changing the IB view planner controls (in the upper bars, under the lower columns, adjust scroll inserts). Building for 5.1, 6.1 and 7.0 leads to the same result when working under 7.0.
self.edgesForExtendedLayout = UIRectEdgeNone
doing nothing. Using layout delta values โโdoes nothing. In IB, the look looks the same when it is "considered as" iOS 7 and iOS 6 and earlier. I print a lot of debugging information, but nothing about the view (or scroll view) seems to change when the view moves off-screen.
Code displaying overlap information (start when the view is first displayed and a single click):
- (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 that hides overlap information:
- (void) hideOverlayInfo { overlayInfoHidden = YES; overlayInfoFading = NO; self.infoButton.hidden = YES; self.descriptionLabel.hidden = YES; [[self navigationController] setNavigationBarHidden:YES animated:YES]; }
So can someone tell me that the (supposedly simple) thing I'm missing out on?