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

actualHeight calculation in AQGridView.m #182

Open
jcole opened this issue Nov 29, 2012 · 0 comments
Open

actualHeight calculation in AQGridView.m #182

jcole opened this issue Nov 29, 2012 · 0 comments

Comments

@jcole
Copy link

jcole commented Nov 29, 2012

Hi, I had an issue where my footer was not displaying at the right height. I believe the cause was below, where the calculation of the actual height of the grid was incorrect. If anyone else can confirm this, I can write this up as a bug and patch.

The issue I saw was on line 694 of AQGridView.m:

actualHeight = [_gridData cellSize].height * ([_gridData numberOfItems] / [_gridData numberOfItemsPerRow] + 1);

I would expect that for a grid with 4 items per row, having either 19 or 20 items in the grid would yield a result of 4 x the cell height. This line works for 19, but not 20--that ends up being 5 rows high.

The fix I made was:

actualHeight = [_gridData cellSize].height * ceil((float)[_gridData numberOfItems] / (float)[_gridData numberOfItemsPerRow]);

Not sure if I broke intended behavior or not, but I know my footer positions properly now.

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