RKLayout icon indicating copy to clipboard operation
RKLayout copied to clipboard

bug in RKLayout.m

Open akucaj opened this issue 13 years ago • 1 comments

There is a small, but ugly copy-paste bug in class RKLayout.m in method - (void)layoutSubviewsHorizontal at line with code 'CGFloat maxSubviewHeight = self.maxSubviewWidth;" there should be "CGFloat maxSubviewHeight = self.maxSubviewHeight;" instead.

  • (void)layoutSubviewsHorizontal { CGFloat horizontalAlignMargin = self.horizontalAlignMargin; CGFloat verticalAlignMargin = self.verticalAlignMargin;

    CGFloat spacing = self.spacing; if (self.spacingMode == RKLayoutSpacingModeAuto) { spacing = (self.frameWidth - self.sumOfSubviewWidths) / (self.subviews.count + 1); }

    CGFloat maxSubviewHeight = self.maxSubviewWidth; // BUG!!! change this line to CGFloat maxSubviewHeight = self.maxSubviewHeight;

    CGFloat currentX = horizontalAlignMargin + spacing; for (UIView* subview in self.subviews) { CGFloat frameX = currentX; CGFloat frameY = verticalAlignMargin; if (self.verticalAlign == RKLayoutVerticalAlignCenter) { frameY = frameY + (maxSubviewHeight - subview.frameHeight) / 2; } else if (self.verticalAlign == RKLayoutVerticalAlignBottom) { frameY = frameY + (maxSubviewHeight - subview.frameHeight); } subview.frame = CGRectMake(frameX, frameY, subview.frameWidth, subview.frameHeight); currentX += spacing + subview.frameWidth; } }

best- Artur Kucaj

akucaj avatar Oct 18 '12 09:10 akucaj

Yes

voidguy avatar Jul 01 '15 08:07 voidguy