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

Handle bounds change on height change #167

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

whatcher2
Copy link

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant