actualHeight calculation in AQGridView.m #182

jcole opened this Issue Nov 29, 2012 · 0 comments


None yet
1 participant

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