nsomar / OAStackView

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

Appending elements to an empty OAStackView looses top constraint #59

Closed ULazdins closed 8 years ago

ULazdins commented 8 years ago

Consider this example:

let stackView = OAStackView()
for view in view {
    stackView.addArrangedSubview(view)
}

As a result of this code the OAStackView has lost constraint between self and first subview.

As far as I understand, the part responsible for this is in OAStackView.h:198

NSArray *constraints = [self constraintsBetweenView:self andView:previousView inAxis:self.axis];
[self removeConstraints:constraints];

When adding second subview, it removes constraints from the first subview, including OAStackView-to-first-subview constraints and never sets them back.

m1entus commented 8 years ago

This was fixed in 0.2.0 !