In the Xcode 6 betas, when I delete a constraint, it doesn't remove it completely, but grays it out. I thought that was to imply that the constraint was used in a different size class, but that doesn't seem to be the case. Also, how do you permanently delete these constraints?
That's because of size classes, you can disable size classes from File Inspector and every greyed constraints runs out, you can re-enable them again if you need them. Hope it helps.
With constraints, you can say “these items are always lined up in a horizontal row” or “this item resizes itself to match the height of that item.” Constraints provide a layout language that you add to views to describe geometric relationships. The constraints you work with belong to the NSLayoutConstraint class.
Feb 25, 2015 at 9:01. It is worth it to point out that when adding new constraints, newer versions of Xcode allow you to uncheck a box for "Constrain to Margins" that sets the same "Relative to Margins" flag. This is useful because it saves a few clicks!
Auto Layout is a constraint-based layout system. It allows developers to create an adaptive interface that responds appropriately to changes in screen size and device orientation.
There are a few ways to delete the constraints from the Storyboard
Try not to delete from the Storyboard object because sometimes different constraints can stack together and you might delete the wrong one. So, it is better to delete from the Document Outline. Just highlight the constraint that you want to delete on the Document Outline and just press delete button on your keyboard. See screen shot below:
If you want to clear all the constraints from a selected view, Select the View (eg: A button), Tap on the Third Button (Resolve Auto Layout Issues Button), Tap Clear Constraints.
If you want to clear all the constraints for all the views inside the view controller, Highlight the right view controller Object inside the storyboard, Tap on the Third Button (Resolve Auto Layout Issues Button), Tap Clear Constraints under the "All Views in the View Controller".
Double click the grayed out constraint (switches focus to the constraint) then press delete. This will delete the constraint.
I believe the answer to the following question is that you can have same constraint selectively "installed" (or to my understanding, enabled) for different size classes. After you select a constraint from Document Outline, you can click on the + sign to Add Size Class Customization from the bottom of Attribute Inspector. So when you delete a constraint from the Size Inspector, you're basically deleting a constraint for a particular size class only. In order to delete a constraint for all size classes, you have to delete from Document Outline.
Why? Why can't you completely delete a constraint from the size inspector?!
You can not delete grayed out constraints from the right hand Size Inspector (which is where I normally delete constraints because it's much easier to ascertain which view the constraints are for, it get's really confusing in the Document Outline), but you can delete the same grayed out constraints from the Document Outline on the left by selecting them and hitting the delete button.
Example of grayed out constraint (see height):
Note: To make the Document Outline's constraints easier to digest, I first delete them from the Size Inspector, which grays them out, then delete the newly grayed out constraint from the Size Inspector. Just FYI.
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