Authored by bibibi

fix a bug cause by set leading or tail space

... ... @@ -41,14 +41,14 @@
}];
break;
case 2:
[arr mas_distributeViewsAlongAxis:MASAxisTypeHorizon withFixedItemLength:30 leadSpacing:5 tailSpacing:5];
[arr mas_distributeViewsAlongAxis:MASAxisTypeHorizon withFixedItemLength:30 leadSpacing:200 tailSpacing:30];
[arr makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(@60);
make.height.equalTo(@60);
}];
break;
case 3:
[arr mas_distributeViewsAlongAxis:MASAxisTypeVertical withFixedItemLength:30 leadSpacing:5 tailSpacing:5];
[arr mas_distributeViewsAlongAxis:MASAxisTypeVertical withFixedItemLength:30 leadSpacing:30 tailSpacing:200];
[arr makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(@0);
make.width.equalTo(@60);
... ...
... ... @@ -100,7 +100,7 @@
MAS_VIEW *v = [self objectAtIndex:i];
[v mas_makeConstraints:^(MASConstraintMaker *make) {
if (prev) {
CGFloat offset = (1-(i/((CGFloat)self.count-1)))*itemLength;
CGFloat offset = (1-(i/((CGFloat)self.count-1)))*(itemLength+leadSpacing)-i*tailSpacing/(((CGFloat)self.count-1));
make.width.equalTo(@(itemLength));
if (i == (CGFloat)self.count - 1) {//last one
make.right.equalTo(tempSuperView).offset(-tailSpacing);
... ... @@ -123,7 +123,7 @@
MAS_VIEW *v = [self objectAtIndex:i];
[v mas_makeConstraints:^(MASConstraintMaker *make) {
if (prev) {
CGFloat offset = (1-(i/((CGFloat)self.count-1)))*itemLength;
CGFloat offset = (1-(i/((CGFloat)self.count-1)))*(itemLength+leadSpacing)-i*tailSpacing/(((CGFloat)self.count-1));
make.height.equalTo(@(itemLength));
if (i == (CGFloat)self.count - 1) {//last one
make.bottom.equalTo(tempSuperView).offset(-tailSpacing);
... ...