Dynamically change axis in UIStackView

I have 2 views in a horizontal UIStackView. I am trying to get the stack view to stay in horizontal mode if possible, but if that is not possible, switch to vertical mode. Demonstrated in the image below. When in the second case it cannot fit horizontally, it changes to vertical:Stack view

How can I achieve this using UIStackViews and autolayout? More generally, I would like to have a view that mimics the flex-wrap CSS properties. I.e:

flex-wrap

It seems like a much more difficult task though.

+3


source to share





All Articles