Bogdan Pop
Bogdan Pop

Reputation: 438

Child view constraints to parent view iOS

I added 4 constrains to a child view of my main view of my initial view controller. Top space and leading space with 0 as the constant and equal width and height with the parent view. No matter what I do the child view won't be at coordinates 0,0 , it always is at coordinates 16,20, even if the constants are 0.

Upvotes: 0

Views: 611

Answers (1)

Senõr Ganso
Senõr Ganso

Reputation: 1734

Delete your top and leading constraints. Then, create them again. Only this time, when you're creating them, uncheck "constrain to margins" checkbox.

This is the checkbox I'm talking about:

enter image description here

Upvotes: 1

Related Questions