Skip to content

Commit

Permalink
fix bug. When hidding the last view, spacing needs remove
Browse files Browse the repository at this point in the history
  • Loading branch information
sinojerk committed Nov 3, 2015
1 parent 4f00feb commit e271851
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion FDStackView/FDStackViewDistributionLayoutArrangement.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ - (void)resetFillEffect {
[self.hiddingDimensionConstraints removeAllObjects];

UIView *offset = self.items.car;
UIView *last = self.items.lastObject;
for (UIView *view in self.items.cdr) {
NSLayoutAttribute attribute = [self minAttributeForGapConstraint];
NSLayoutRelation relation = [self edgeToEdgeRelation];
NSLayoutConstraint *spacing = [NSLayoutConstraint constraintWithItem:view attribute:attribute relatedBy:relation toItem:offset attribute:attribute + 1 multiplier:1 constant:self.spacing];
spacing.identifier = @"FDSV-spacing";
[self.canvas addConstraint:spacing];
[self.edgeToEdgeConstraints setObject:spacing forKey:offset];
if (offset.hidden) {
if (offset.hidden || (view == last && view.hidden)) {
spacing.constant = 0;
}
offset = view;
Expand Down

0 comments on commit e271851

Please sign in to comment.