Invalid number of rows (columns ?) #183

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

Comments

Projects
None yet
1 participant

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