0

This is entirely a landscape only mode app.

I have a XIB with:

  • Size: Retina 4-inch Full screen
  • Orientation: Landscape
  • Status Bar: Default
  • Top Bar: Opaque Navigation Bar
  • AutoLayout: Enabled.

The View in Interface Builder shows:

  • origin.y = 64px
  • height = 256px

Well I know the status bar is 20px, so that means IB thinks the navbar in landscape mode is 44px.

When I run the app with some logging I get the following:

  • navbar.origin.y = 20 (the size of the status bar)
  • navbar.size.height = 32
  • view.size.height = 256

So add that up, 308, missing 12pixels.

Sure enough none of my UI reaches the bottom of any view anymore. There is 12 pixels at the bottom of every view setup similar to above.

I track this down to IB thinking the navbar is 44px in landscape mode even though it should be 32px. Which explains the 12px difference. IB is calculating the view height wrong because of this.

Any help appreciated, this has plagued us since IOS7.1 and XCode5.1. App was working perfectly before.

Aaron
  • 7,055
  • 2
  • 38
  • 53
Halsafar
  • 2,540
  • 4
  • 29
  • 52
  • Have you configured Interface Builder to display the views in landscape? Navigation bars that belong to navigation controllers are resized to 32pt height in landscape. – Léo Natan Apr 11 '14 at 18:31
  • Best practice here is, instead of relying on hardcoded values such as 44pt and 32pt, use autolayout to define constraints based on the top layout guides of the view controller. – Léo Natan Apr 11 '14 at 18:31

0 Answers0