9

I am simply adding a UIView into the main view of a view controller. I want the height to always be 64px, but the width to stretch to the width of the screen.

However, when I go to add constraints, the left and right padding default to -16, even though the view is stretched all the way across its parent view. Even if I set these back to 0, when I run the app the -16 padding is added back in. What is going on here?

enter image description here

enter image description here

enter image description here

soleil
  • 12,133
  • 33
  • 112
  • 183
  • Just add Leading space to constrainer & Tailing space to constrainer in UIView with the boarder of UIViewController – DilumN Sep 12 '14 at 19:33
  • I did that. But I can see the reason behind this padding. Would you please enlighten me. Thanks – Abdul Yasin Sep 29 '14 at 06:07

1 Answers1

12

Uncheck "Constrain to margins" checkbox in the pin menu (the first image in the question) while adding spacing to nearest neighbor for the new constraints.

Ganesh Kamath
  • 1,181
  • 11
  • 20