What is “Constrain to margin” in Storyboard in Xcode 6

I am Working with autolayout and constraints and found there is a Constrain to margins option in Xcode 6 which was not present in Xcode 5 and is checked by default.

I created a test project then I added a UITableView on a ViewController with the frame set to the same size as view and added constraints

Xcode 6
You can see here even though tableview has the same frame as view Xcode suggests to add -16 as constraint whereas Xcode 5 would suggest adding spacing 0.

With Constrain to margin checked

Now when you uncheck “Constrain to margin” option it behaves same as Xcode 5 and would suggest adding 0 as constraint

With Constrain to margin UnChecked

Also, I found that once I add constraint with Constrain to margin checked, I am no longer able to open the storyboard file in Xcode 5 so it’s definitely something new in Xcode 6

Hopefully, I am able to explain my question properly. I would like to understand what “Constrain to margin” actually does and when I should and should not use it. I do apologize if it’s something very simple and obvious.

EDIT

I found something about layout margins in discussion here , I wonder if it’s related to this.

3 Answers
3

Leave a Comment