IOS auto layout: how to dynamically evenly position objects?

I need to evenly position the X elements, and the container for the elements can have a dynamic width, and I want the first and last elements to adhere to the left and right edges:

|-0-[item1]-[...]-[itemX]-0-|

so that regardless of the width of the container, the elements are always evenly distributed, how to implement this with layout restrictions?

edit: I thought that if I can set item1 and item2 to the same intervals as item2 and item3 etc., then this should be easy, but I don’t think I can set it without a constant width?

+4
source share
1 answer

, "spacer".

, ...

@"|[view1][spacer1][view2(==view1)][spacer2(==spacer1)]...[spacerN(==spacer1)][viewN]|"

.

, -0 .

+9

All Articles