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

Invalid number of rows (columns ?) #183

Open
iclems opened this issue Nov 30, 2012 · 0 comments
Open

Invalid number of rows (columns ?) #183

iclems opened this issue Nov 30, 2012 · 0 comments

Comments

@iclems
Copy link

iclems commented Nov 30, 2012

Hi,

I've been faced several times with a very strange issue, but which seems pretty logical to me: I end up with the last row being hidden if (number of items / number of columns) gives any result with < ,5

Example : 10 items, 3 columns = 3 rows (outch...)

This is due to this line (but after a bit of research, it may be a wider issue of how things get rounded, even for columns). In the following line, 10/3 = 3 as the standard float => just removes the float part of the integer, while to get the number of rows you need to ceil it. Maybe I'm missing some "config" point of the project ? :

  • (NSUInteger) numberOfRows
    {
    return _gridData.numberOfItems / _flags.numColumns;
    }

My solution :

  • (NSUInteger) numberOfRows
    {
    return (NSUInteger)ceilf((CGFloat)_gridData.numberOfItems / (CGFloat)_flags.numColumns );
    }
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

1 participant