Skip to content

Commit

Permalink
Merge branch 'master' of github.com:forkingdog/FDStackView
Browse files Browse the repository at this point in the history
  • Loading branch information
wtlucky committed Dec 24, 2015
2 parents 4f406cd + 6cf50ed commit 6d7141e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions FDStackView/FDStackView.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ - (void)removeArrangedSubview:(UIView *)view {
}
[self removeHiddenObserverForView:view];
[self.mutableArrangedSubviews removeObject:view];
[view removeFromSuperview];
[self.alignmentArrangement removeItem:view];
[self.distributionArrangement removeItem:view];
[self updateLayoutArrangements];
Expand Down
8 changes: 4 additions & 4 deletions FDStackView/FDStackViewAlignmentLayoutArrangement.m
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ - (void)setAlignment:(UIStackViewAlignment)alignment {
#pragma mark - Override Methods

- (void)removeDeprecatedConstraints {
[self.alignmentConstraints enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSMapTable * _Nonnull mapTable, BOOL * _Nonnull stop) {
[self.alignmentConstraints enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSMapTable *mapTable, BOOL *stop) {
[self.canvas removeConstraints:mapTable.fd_allObjects];
}];
[self.alignmentConstraints removeAllObjects];
Expand Down Expand Up @@ -293,7 +293,7 @@ - (void)updateCanvasConnectionConstraintsIfNecessary {
[self.canvasConnectionConstraints addObject:canvasFitConstraint];
}

[canvasAttributes enumerateObjectsUsingBlock:^(NSNumber * _Nonnull canvasAttribute, NSUInteger idx, BOOL * _Nonnull stop) {
[canvasAttributes enumerateObjectsUsingBlock:^(NSNumber *canvasAttribute, NSUInteger idx, BOOL *stop) {
NSLayoutAttribute attribute = canvasAttribute.integerValue;
NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:[self viewOrGuideForLocationAttribute:attribute] attribute:attribute relatedBy:[self layoutRelationForCanvasConnectionForAttribute:attribute] toItem:self.canvas attribute:attribute multiplier:1 constant:0];
constraint.identifier = @"FDSV-canvas-connection";
Expand Down Expand Up @@ -378,7 +378,7 @@ - (void)updateSpanningLayoutGuideConstraintsIfNecessary {
[self.spanningLayoutGuide.systemConstraints addObject:constraint];

//FDSV-spanning-boundary
[self.mutableItems enumerateObjectsUsingBlock:^(UIView * _Nonnull item, NSUInteger idx, BOOL * _Nonnull stop) {
[self.mutableItems enumerateObjectsUsingBlock:^(UIView *item, NSUInteger idx, BOOL *stop) {
NSLayoutConstraint *minConstraint = [NSLayoutConstraint constraintWithItem:self.spanningLayoutGuide attribute:self.minAttributeForCanvasConnections relatedBy:[self layoutRelationForItemConnectionForAttribute:self.minAttributeForCanvasConnections] toItem:item attribute:self.minAttributeForCanvasConnections multiplier:1 constant:0];
minConstraint.identifier = @"FDSV-spanning-boundary";
minConstraint.priority = 999.5;
Expand Down Expand Up @@ -406,7 +406,7 @@ - (void)updateAlignmentItemsConstraintsIfNecessary {
self.hiddingDimensionConstraints = [NSMapTable weakToStrongObjectsMapTable];

UIView *guardView = self.mutableItems.firstObject;
[self.mutableItems enumerateObjectsUsingBlock:^(UIView * _Nonnull item, NSUInteger idx, BOOL * _Nonnull stop) {
[self.mutableItems enumerateObjectsUsingBlock:^(UIView *item, NSUInteger idx, BOOL *stop) {
if (self.alignment != UIStackViewAlignmentFill) {
NSLayoutConstraint *ambiguitySuppressionConstraint = [NSLayoutConstraint constraintWithItem:item attribute:self.alignmentConstraintsFirstAttribute relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:0];
ambiguitySuppressionConstraint.identifier = @"FDSV-ambiguity-suppression";
Expand Down
5 changes: 3 additions & 2 deletions FDStackView/FDStackViewDistributionLayoutArrangement.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ - (void)resetSpacingOrCenteringGuides {
return;
}

[[visiableItems subarrayWithRange:(NSRange){0, visiableItems.count - 1}] enumerateObjectsUsingBlock:^(UIView * _Nonnull item, NSUInteger idx, BOOL * _Nonnull stop) {
[[visiableItems subarrayWithRange:(NSRange){0, visiableItems.count - 1}] enumerateObjectsUsingBlock:^(UIView *item, NSUInteger idx, BOOL *stop) {
FDGapLayoutGuide *guide = [FDGapLayoutGuide new];
[self.canvas addSubview:guide];
guide.translatesAutoresizingMaskIntoConstraints = NO;
Expand Down Expand Up @@ -169,7 +169,7 @@ - (void)resetSpacingOrCenteringGuideRelatedDimensionConstraints {
if (visiableItems.count <= 1) return;

FDGapLayoutGuide *firstGapGuide = [self.spacingOrCenteringGuides objectForKey:visiableItems.car];
[self.spacingOrCenteringGuides.fd_allObjects enumerateObjectsUsingBlock:^(UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
[self.spacingOrCenteringGuides.fd_allObjects enumerateObjectsUsingBlock:^(UIView *obj, NSUInteger idx, BOOL *stop) {
if (firstGapGuide == obj) return;
NSLayoutAttribute dimensionAttribute = [self dimensionAttributeForCurrentAxis];
NSLayoutConstraint *related = [NSLayoutConstraint constraintWithItem:firstGapGuide attribute:dimensionAttribute relatedBy:NSLayoutRelationEqual toItem:obj attribute:dimensionAttribute multiplier:1 constant:0];
Expand Down Expand Up @@ -256,4 +256,5 @@ - (NSLayoutAttribute)minAttributeForGapConstraint {
- (void)updateCanvasConnectionConstraintsIfNecessary {
[self resetAllConstraints];
}

@end

0 comments on commit 6d7141e

Please sign in to comment.