Nav bar item y position

Hi,

I have a fairly common looking nav bar. It works great in iOS 8 on all devices (iPhones and iPads) and orientations. It also works great on iOS 9 in landscape mode but on iOS 9 and iPhone 6, 5 and 4 in portrait mode the items have their Y position shifted up. It looks good on 6p and iPads (both orientations).


I have removed everything from the nav bar and have tested the problem with just a System Done button and the problem still exists (again only in iPhone 4, 5 and 6 in portrait). View debugging shows the item shifted up by 6 pixels.


I'm using Xcode 7.1 and everything is on a storyboard.


Any ideas what is happening?


Thanks.

What height is the navigation bar when it isn't working as you expect?


The device you mention as failing are all the cases where the navigation bar switches height, between 44pt (in portrait) and 32pt (in landscape). I'm not certain what is happening (I would have expected problems in landscape given what you describe not portrait) but it seems odd enough that you may have a misconfiguration that I don't understand.

Hi, Are you sure about the 32pt in landscape? I'm always seing the height as 44pt in the view debugger (landscape and portrait).


The view with with the issue usually starts in landscape mode. I see the problem when I rotate to portrait. Just on a hunch, I allowed the view to come up in portrait mode and the nav bar items/buttons look good.


I'm using autolayout and size classes.


Will continue digging ...

I created a test app with a couple of VCs just to test this issue. The problem reproduces 100%.


There's no code (besides a dismissVC call) and only two VCs. If the app is started in landscape mode and you switch to the 2nd VC and then rotate to portrait mode then the bar items are missplaced. This happens all the time in iOS 9 on iPhone 4S, 5/5S and 6/6S (simulator and device). Does not happen in iOS 8 nor iOS 9 on iPhone 6Plus and iPad.


So, I decided to file a bug report. Lets see what happens!

44pt is the wrong height for landscape on devices smaller than the iPhone 6[S] Plus. If you are seeing 44pt height on iPhone 6 or below sized devices, the layout is likely to be wrong in the bars themselves.


You should verify that your layout is allowing the bars to size themselves propery (for example by not having a 44pt height constraint on the bars) in order to get the correct layout behavior.

OK. I finally figured this out ... My problem was that I was implementing a navigation item without a navigation controller. Sometime ago I read that this was possible and I decided to try it out because having a navigation controller seemed a bit of an overkill (in my case). So, I decided to go back to the more conventional way of doing things (i.e.: with a navigation controller) and now my nav bar looks fine on all devices and all orientations. And, as you pointed out, it's 32 pts in landscape.

Nav bar item y position
 
 
Q