In Xcode 6, I could use the Editor menu to Pin:
I can't find a way to do this in Xcode 7 beta. If I press the Align button in the Storyboard view, I see:
Which I assume is the same thing, but they are all greyed out.
Adding these 4 constraints in Xcode 6 would have taken about 20 seconds, but it took me 30 minutes to put it in Xcode 7 and can't figure it out.
Unfortunately they removed this option from the Editor Menu but there is a drop-down menu. There you can select another view to which you can assign your margins. .
To pin Top, Bottom, Leading, and Trailing to the Superview, do this:
If you click Add Constraints button, it will pin top, leading, and trailing to the Superview, and bottom to the Bottom Layout Guide. If you want to pin bottom to the Superview also, press the drop down arrow next to the bottom value and choose View instead of Bottom Layout Guide. Then click Add Constraints.
Well, I also meet this problem in Xcode 7.2, and have found out a way to solve it.
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. After adding the constraint you can release the "control" button. Note that the direction you drag will affect the available constraints at this time. For example, if you drag left, then the trailing constraint may be unavailable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With