How to split UIView into equal parts using autorun?

I am afraid to find a logical rule or restriction that will allow me to split the contents of a UIView into equal parts.

To be more specific, imagine a UIView with an initial width of 300pt. Then put three subheadings and configure them so that each one has a width of 100 and origin.x will be 0, 100 and 200. One subquery will make up one third of the supervisor. If I changed the size of the supervisor, all three sub-items will expand horizontally, but they will be the same size.

Any help?

+7
ios objective-c autolayout uiview
source share
2 answers
  • Post your presentation.
  • Place and arrange your three subitems, each one one third of the width.
  • Select all three routines by holding cmd and clicking on each.
  • Go Editor> Pin> Widths Equally

Make sure you set limits for the subview x and y position. In your case, you will associate the leading space with the leftmost view for the supervisor and occupy the space of your rightmost submission for the supervisor (Editor> Pin> Leading / Trailing space for viewing) and the vertical interval, depending on your case.

+15
source share

Constraints of equal width / height will do this for you.

In the visual format, the restrictions will be:

|[view1][view2(==view1)][view3(==view1)]| 

The left part is attached to the left of the supervisor, the right part is fixed to the right, the center is pressed to the two outer ones, and all three are made of equal widths.

+3
source share

All Articles