Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot add new alignment constraints auto layout Xcode 6

Tags:

Why I cannot add new alignment constraints on my scroll view ?

alignement

like image 884
cmii Avatar asked Jan 11 '15 18:01

cmii


People also ask

How do you add constraints in Xcode?

In Xcode 7.2 (and perhaps also in your version of Xcode), firstly select the view that you want to add constraint to, and then press the "control" button on your keyboard and keep doing it, and then drag the view to the super-view. Then a menu will appear, and then you can select to add some constraints.

How do I change constraints in Xcode?

Some editing is also possible directly from the Size inspector. Clicking the Edit button in any of the constraints brings up a popover where you can change the constraint's relationship, constant, priority, or multiplier.

What is AutoLayout?

Auto layout is a system which lets you perform lay out using mathematical relationships. It is based on the incremental cassowary constraint solving toolkit and uses the awesome Cassowary. js library. AutoLayout.


Video Answer


2 Answers

In order to add alignment constraints, you must select two or more items before pressing the Align button. This is how Interface Builder knows which two objects to align. You can select the items by dragging a box around them, or you can hold down Shift and select the items.

like image 94
vacawama Avatar answered Oct 26 '22 20:10

vacawama


If you are aligning to centre horizontally/vertically (which doesn't require a second view for reference) and still get this issue, then go to the size inspector (ruler icon in the top right navbar) and change the layout dropdown to Automatic.

This should then enable values and the button in the alignment constraints dialog.

like image 31
Maximillion Bartango Avatar answered Oct 26 '22 21:10

Maximillion Bartango