Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change order of constraint listings in Interface Builder's document outline

Is it possible to change the order of the various top level constraints that show up in the document outline? The top level constraints are where all the various constraints between my many label elements are and I'd like to organize them into logical groupings to streamline my work flow. Currently, they are listed in the same order that I added them, however this is not ideal. While you can drag and reorder individual elements around in the document outline it does not appear that you can reorder constraints. Is there a work around or simply something I am missing?

like image 882
Alex Bollbach Avatar asked Mar 31 '16 00:03

Alex Bollbach


People also ask

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 is translatesAutoresizingMaskIntoConstraints?

translatesAutoresizingMaskIntoConstraints. A Boolean value that determines whether the view's autoresizing mask is translated into Auto Layout constraints.

What is Autolayout?

Auto Layout defines your user interface using a series of constraints. Constraints typically represent a relationship between two views. Auto Layout then calculates the size and location of each view based on these constraints. This produces layouts that dynamically respond to both internal and external changes.

Should I line up the views with constraints in Interface Builder?

Therefore, you need to position the views carefully before you draw the constraints. If you line up the views based on Interface Builder’s guidelines, you should end up with a reasonable set of constraints. If necessary, you can always edit the constraints afterward.

How can i Improve my updateconstraints implementation?

Your updateConstraints implementation must be as efficient as possible. Do not deactivate all your constraints, then reactivate the ones you need. Instead, your app must have some way of tracking your constraints, and validating them during each update pass.

What is the difference between base class constraint and interface constraint?

Base class constraint: where T: BaseClass 4. An example explaining the constraint on the base class. Figure 5. Interface constraint: where T: Interface 6. An example explaining the bound to the interface

What is a constraint on a layout guide?

These guides can also act as items in a constraint, supporting the top, bottom, and height attributes. Typically, you constrain views to the top layout guide’s bottom attribute or to the bottom layout guide’s top attribute.


2 Answers

This cannot be done graphically in Interface Builder (tested in XCode 7.3). Also, if you right-click the .storyboard/.xib file and select "Open As -> Source Code", the constraints for your view can be reordered by changing the order of the respective XML elements, but once you switch back to Interface Builder, their order will be reverted.

like image 103
stakri Avatar answered Oct 05 '22 13:10

stakri


The order should be drag&drop replaceable, perhaps in future versions of Xcode. I still do not see it implemented on Xcode 9.

like image 40
TamerK Avatar answered Oct 05 '22 13:10

TamerK