Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Handle bounds change on height change #167

wants to merge 2 commits into


None yet
1 participant

The setFrame method of AQGridView used to only call handleGridViewBoundsChanged if the bounds width actually changes. (This to prevent unnecessary work if setFrame is called again with same bounds I suppose) But there are cases when the height will change and the grid content height needs to be recalculated appropriately. This patch detects a change to height as well so that happens.

In my case a large 3x4 (portrait) and 4x3 (landscape) grid table is displayed in a view with a navigation bar. A cell is selected causing another view to be pushed on the stack. That view is rotated and we return to the grid. SetFrame is called twice, the 1st time it resets the frame height & width to the new orientation, BUT without accounting for the navigation bar. The 2nd time it resets the frame to account for the bar, but the width is the same. The old logic bypassed the logic I added to the parent branch that recalculates the current content offset proportionally to the height so the content stays in view. So the 1st time setFrame is called the cells are all calculated to be a little taller (to fit) and depending on the size of the table and how far down you scrolled results in the view showing cells that are a number of rows away from those shown before the rotation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment