brian
brian

Reputation: 166

IOS navigationBar not to edge of screen

I have a Navigation Bar in my storyboard, and set the folowing constraints:

Horizontal Space - (-16) - View Navigation Bar
Horizontal Space - (-16) - Navigation Bar View
Vertical Space - (8) - Navigation Bar - Top Layout Guide

However it appears like this:

enter image description here

Both in portait and Landscape oriantation.

How can i fix it so that i do not have 3 pixels of White space? (also does this on my Iphone 6plus)

I used the Inferred Size option. It works on Iphone 4S, Iphone 5, iphone 5S, iphone 6.

Upvotes: 0

Views: 193

Answers (1)

brian
brian

Reputation: 166

My constrains seem to indicate that i have constrained the view against its Superview's margins, rather then against its actual edges. Because the margins are different between other phones and iPhone 6 Plus, my navigation bar ends up inset (because constant 16 isn't large enough).

I turned margin based constrains off in the same popup that i used to create these, but i had to remove the constraints i set first.

Steps to fix:

  1. Click navigation bar
  2. Click pin (the |-[]-| ) thing on the right bottom corner (3rd from the right 2nd from the left).
  3. Click 'constrains to margins'

enter image description here

Source Rincewind from Apple: https://devforums.apple.com/message/1099289#1099289

Upvotes: 2

Related Questions