Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I (easily) delete a constraint in Interface Builder in Xcode 6

Assume you've selected an object and you have the Size Selector in the Utilities panel open. You can see the list of constraints applied to the object. In the list of constraints you could click on the little gear and pick delete. You can't in Xcode 6.

There are still several ways to delete constraints in IB:

  • Find the constraint in the Document Outline and delete it that way (but it can be hard to find).
  • Click on the little bar in the storyboard and delete it that way (which can be hard to click on).
  • Double click on the constraint in the Size Selector which will open Attribute Inspector and highlight the constraint in the Document Outline. This can be a nuisance when you want to delete several.

Still, I miss ease of use of the gear delete feature and I'm wondering if it's still there in a similar fashion and I just can find it. While the other ways work, I find myself wasting lots of time especially when playing with the new Size Classes feature. So, find a easier way to delete them?

like image 296
DBD Avatar asked Jun 18 '14 18:06

DBD


People also ask

How do I delete a constraint in Xcode?

Open Utilities panel on XCode and select Size Inspector. Here list of all constraints are listed for selected view in storyboard. Now, select constraint(s) you want to delete. Now hit Backspace key on keyboard and selected constraints are deleted.

How do I change constraints in Xcode?

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. To make additional changes, double-click the constraint to select it and open it in the Attribute inspector.

What does constrain to margins mean in Xcode?

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!

How do you delete an object in Xcode storyboard?

Select the object and the press the delete key. You could also then click on the edit menu and choose delete.


2 Answers

In Xcode6 (Beta5) when I click on a particular constraint in the Size inspector, it acquires a thin blue border. The constraint can then be deleted using the backspace.

like image 96
Paul Patterson Avatar answered Sep 30 '22 14:09

Paul Patterson


The accepted answer is right, but there is so much frustration with selecting constraints that lay outside of selected view that I decided to add this tips as another answer.

I found incredible list of tips that helped me to solve this problem.

The problem:

  1. You select the view and Xcode shows related constraints.
  2. You try to choose the one that is outside of selected view.
  3. You fail (end with selecting the view beneath the constraint)

enter image description here

Soulution:

Click it with Shift+Ctrl pressed and you'll see a menu of all the views that exist where you've clicked.

To delete selected constraint press delete key.

enter image description here

like image 40
DanSkeel Avatar answered Sep 30 '22 13:09

DanSkeel