Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in RKLayout.m #2

Open
akucaj opened this issue Oct 18, 2012 · 1 comment
Open

bug in RKLayout.m #2

akucaj opened this issue Oct 18, 2012 · 1 comment

Comments

@akucaj
Copy link

akucaj commented Oct 18, 2012

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

@voidguy
Copy link

voidguy commented Jul 1, 2015

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants