bug in RKLayout.m
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
Yes