4

I use storyboard and autolayout.

I place a thin UIView inside a UIViewController's UIView (which gets pushed to a UINavigationController). Then I add constraint to make the thin UIView resize itself to keep x-margin = 0 and x-ending-margin = 0. (left edge to right edge)

I see that it recommends the value for the constraint as -20 and also -20 for the trailing space. If I set it to 0, I see whitespace before and after my UIView. Why? What is that -20?

When I test it on a small device like iPhone 5, I see that -20 becomes more like -30 or something..

Why does that happen? Is there a way to somehow fix it so I can safely use 0 as the constraint for every situation?

frankish
  • 6,738
  • 9
  • 49
  • 100

0 Answers0