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

Infinite loop. #20

Open
kaylanx opened this issue Jun 23, 2014 · 1 comment
Open

Infinite loop. #20

kaylanx opened this issue Jun 23, 2014 · 1 comment

Comments

@kaylanx
Copy link

kaylanx commented Jun 23, 2014

It seems that if I try and use the

-UIViewShowAlignmentRects YES

Setting in my app, then RZCellSizeManager doesn't work properly, and goes into an infinite loop.

Commenting out the layoutIfNeeded, seems to fix it...

  • (NSNumber )cellHeightForObject:(id)object configuration:(RZCellSizeManagerCellConfiguration *)configuration
    {
    NSNumber
    height = nil;
    if (configuration)
    {
    if (configuration.configurationBlock)
    {
    [configuration.cell prepareForReuse];
    configuration.configurationBlock(configuration.cell, object);
    // [configuration.cell layoutIfNeeded];
    UIView* contentView = [configuration.cell contentView];
    height = @([contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height + self.cellHeightPadding);
    }
    else if (configuration.heightBlock)
    {
    height = @(configuration.heightBlock(configuration.cell, object) + self.cellHeightPadding);
    }

    }
    return height;

}

@ndonald2
Copy link
Contributor

@kaylanx If commenting out layoutIfNeeded works consistently even without alignment rects turned on, please open a pull request to fix the issue. Thanks.

kaylanx pushed a commit to kaylanx/RZCellSizeManager that referenced this issue Aug 16, 2014
Rightpoint#20.

Instead of calling layoutIfNeeded, call setNeedsLayout, this stops the
infinite loop if UIViewShowAlignmentRects is turned on.
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