ScottRobbins / DeclarativeLayout

A declarative, expressive and efficient way to lay out your views.
MIT License
5 stars 0 forks source link

Should not have constraint issues when moving views out of UIStackView #12

Closed ScottRobbins closed 5 years ago

ScottRobbins commented 5 years ago

In the README I said

UIStackViews aren't built in a way that makes it convenient to deal with the constraints they add to their arranged subviews. To avoid some hard-to-find bugs, avoid transitioning views from being arranged subviews of a UIStackView to not being arranged subviews of the UIStackView.

I kind of lied, I can build this myself. For some reason I totally missed the removeArrangedSubview method. Anyway I should support this.

ScottRobbins commented 5 years ago

This bug only seems to show up if a view is an arranged subview of a stackview and you change it to still be a subview of a stackview, but no longer arranged.

ScottRobbins commented 5 years ago

So it seems that removeArrangedSubview doesn't help. Idk what the hell the stack view is doing but it's not letting go of the constraint early enough on the arranged subview so you still get things printed in the console.

ScottRobbins commented 5 years ago

Not super excited about it but i may need to remove the view from superview (the stack view) and then have it re-insert into the view hierarchy where needed.

ScottRobbins commented 5 years ago

fixed here