nsomar / OAStackView

Porting UIStackView to iOS 7+
MIT License
2.14k stars 200 forks source link

Sequence error in layout subviews by using OAStackView #72

Open zlanchun opened 8 years ago

zlanchun commented 8 years ago

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

Pretz commented 8 years ago

@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.

samus commented 8 years ago

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.