0
votes

I'm trying to get a UINavigationBar to stick to the left and right edges of the screen and so I'm trying not have it be constrained to the margins.
In the storyboard, for the few constraint buttons on the bottom right, there is one option that has a checkbox for "constrain to margins." I am trying to uncheck this box for my UINavigationBar, but the constraint remains checked after I uncheck it. After I uncheck it, the button for "add constraints" remains gray, and I end up clicking out of the popup window. But when I do that, the constrain to margins remains checked when I look at it again. Is this a bug and is there a way to fix this?

1
can you post some screen shots ?sourav
It Might be a bug from Xcode,Try restarting Xcode.Rohit Pradhan
So I have even updated XCode from 7.1 to 7.2 before restarting it. Still does not work First image, box is checked, postimg.org/image/s4gnaeryp Second image, unchecked the box, postimg.org/image/sv9dg6uc1 Final image, the box remains checked, postimg.org/image/g1bbmugwhSwiftMatt

1 Answers

0
votes

Though it still seems that there is no way to uncheck the "constrain to margins" box in XCode, it is still possible to add constraints to your views that are not "constrained to margins" by control dragging from a view to its superview while holding down the option key as shown in the first image.

enter image description here Another method to not be constrained to margins is to click on the constraint in the inspector (the constraint itself and not the edit button) and uncheck the relative to margin option as shown by the second image.

enter image description here