Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - Is there a way to show Autolayout constraints while debugging?

Tags:

ios

autolayout

I want to be able to see the NSLayoutConstraints that I have set between individual UILabels while debugging. Is this possible?

like image 957
Valentin Avatar asked May 19 '14 09:05

Valentin


People also ask

How do you add constraints in storyboard IOS?

Open the Align menu with the yellow button selected and check Horizontally in Container, then click Add 1 Constraint. Now, select both buttons at the same time using the Shift key and, in the Align menu, check Leading Edges. Again, actually install the constraint by clicking Add 1 Constraint.

What is constraint to margin in IOS?

Basically if the layout margins are 8,8,8,8 (the default), a constraint with 0 leading space to container margin will have an x position of 8. Note that this is only available on iOS8 or later.

How do I use Autolayout?

You can add auto layout to a selected frame, component, or component set from a few places: Use the keyboard shortcut ⇧ Shift A . In the right sidebar, click next to Auto layout with a frame selected. Right-click on a frame or object and select Add Auto layout.


1 Answers

With Xcode 6, there is a way to show the constraints while debugging.

  1. Run your application on either simulator or device.
  2. Select 'Debug View Hierarchy' which appears between 'Step out' and 'Simulate Location'enter image description here

  3. Select the control that you want to view the constraints

enter image description here

  1. Select 'Show Constraints'

enter image description here

Result:

enter image description here

like image 104
Valentin Avatar answered Sep 19 '22 14:09

Valentin