Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find a constraint using the hex code

I have some issues with auto layout, where the console says there are conflicting constraints. However, when Xcode attempts to fix the issue, everything works as intended. In the console it reports

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fe578db22f0 V:[UILabel:0x7fe578d9b200'Label'(32)]>

I want to find the constraint mentioned: "0x7fe578db22f0" and delete it manually.

Is there anyway to find it by using that hex code? And if not, can anyone suggest a way to fix my issue? I have a lot of constraints and it would be very difficult to go through and test each one.

like image 999
multitaskPro Avatar asked Jun 29 '16 05:06

multitaskPro


People also ask

What is translatesAutoresizingMaskIntoConstraints?

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

What is Nslayoutconstraint in Swift?

The relationship between two user interface objects that must be satisfied by the constraint-based layout system.

What is layout guide IOS?

Use layout guides to replace the placeholder views you may have created to represent inter-view spaces or encapsulation in your user interface. Traditionally, there were a number of Auto Layout techniques that required placeholder views.


1 Answers

If the question is merely how to identify which view that constraint is associated with, the easiest way is probably using the view debugger. So, run the app and click on the "debug view hierarchy" button. Then examine your view hierarchy in the left panel (narrowing it down by searching for view type, if you want), until you see a constraint that looks like the one in question. And by choosing the object inspector, you can confirm the address of the constraint in question.

view debugging

Now that you've identified the precise constraint and view in question, the tracking down of its creation in the app should be much easier.

like image 179
Rob Avatar answered Oct 03 '22 08:10

Rob