ios - Same width for a set of labels using auto layout -


I need to create a simple layout with some labels and buttons. Here I have explained how I have UI elements in IB Have kept.

Enter image details here

In this way I want them There's a single width label set on the left side to see the app as well, so that the elements on the right can adjust its width accordingly.

I have set the leading position for supervision constraints on the left side of the labels and have set vertical difference between each of them. Similarly I can see the vertical spacing between each other on the right side of the labels and buttons. The space is kept behind the obstacle. I've added horizontal spacing between each element (ex: name & lt; -> John do, telephone & lt; -> button).

When I run it, it seems.

Enter image details here

The element should only be of its width Take the form of materials I think this problem occurs because there is no way of auto layout to make decisions on the width. If I set the labels at the same width interrupt on the left side, then it does not work on the runtime because they are fixed for them, so they look like this.

Enter image details here

How do I fix these Can I see as if I am in the interface builder?

Thank you.

I have uploaded a test Xcode project with this problem.

In your last example, it seems that what you wanted to achieve was you left All labels have created the same width. Now you can set the width of a width for a width that works for you, and other labels will be automatically matched. You still have the only issue that looks good on a wider screen.


Comments