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

Cell's calculatedHeight is always nil #36

Closed
respan opened this issue Apr 4, 2016 · 1 comment
Closed

Cell's calculatedHeight is always nil #36

respan opened this issue Apr 4, 2016 · 1 comment

Comments

@respan
Copy link

respan commented Apr 4, 2016

Hey. I'm using Hakuba and so far it's great, but i think i found a bug. Cell's calculatedHeight property is always nil, even after all this calculations:

private extension CellModel {
    func calculateHeight() -> CGFloat {
        if let height = calculatedHeight {
            return height
        }

        guard let cell = delegate?.getOffscreenCell(reuseIdentifier) else {
            return estimatedHeight
        }

        cell.configureCell(self)

        let width = delegate?.tableViewWidth() ?? UIScreen.mainScreen().bounds.width
        cell.bounds = CGRectMake(0, 0, width, cell.bounds.height)
        cell.setNeedsLayout()
        cell.layoutIfNeeded()

        let size = cell.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize)
        return size.height + 1
    }
}

I think you should set it to a value before returning from function.

@respan respan changed the title Cell calculatedHeight is always nil Cell's calculatedHeight is always nil Apr 4, 2016
@nghialv
Copy link
Owner

nghialv commented Apr 4, 2016

@respan Great! Many thanks for your reporting. I have just fixed this bug and released a new version.

@nghialv nghialv closed this as completed Apr 4, 2016
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