OAStackView icon indicating copy to clipboard operation
OAStackView copied to clipboard

Sequence error in layout subviews by using OAStackView

Open zlanchun opened this issue 10 years ago • 2 comments

In storyboard I put a view of OAStackView, and drag 3 Labels into this view. I want the sequence is [Label1 Label2 Label3], but when I running this demo, the sequence is different. It becoming [Label2 Label3 Label1]. Someone can help me?

Stack View set: Axis value: 1 spacing: 10 Alignment Value: 4 Distribution Value: 3 like this: snip20160106_1 snip20160106_3 Running result: snip20160106_4

zlanchun avatar Jan 06 '16 04:01 zlanchun

@zlanchun OAStackView orders views in the order they are placed in their superview, not based on x-y coordinates. Make sure your views are ordered correctly in the outline view of interface builder: outline view

You can drag the subviews in the outline to order them as desired.

Pretz avatar Jan 20 '16 22:01 Pretz

I've also seen in Xcode 7.2 at least that the ordering showing in the sidebar isn't always reflective of the order they are added at runtime. Rearranging the views in the sidebar and then putting them back to the correct order has fixed the problem for me. I don't know if other versions have this problem or not.

samus avatar Feb 26 '16 02:02 samus