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

Maintain the same visible items after rotation #97

Merged
merged 2 commits into from
Dec 18, 2021

Conversation

bryankeller
Copy link
Contributor

Details

This makes it so that MagazineLayout will maintain a similar scroll position after rotation. It does this by introducing some additional bookkeeping so that we know which item was closest to the top before the rotation. We then ensure that our target content offset positions this item at the top after rotation.

As usual, UICollectionViewLayout is an undocumented, confusing mystery. 4 calls to prepare(forAnimatedBoundsChange oldBounds:) for one rotation? Makes sense!

image

Related Issue

N/A

Motivation and Context

Slight behavior improvement - nothing major.

How Has This Been Tested

Tested on iOS simulator; iPhone and iPad.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@bryankeller bryankeller added the enhancement New feature or request label Dec 10, 2021
brynbodayle
brynbodayle previously approved these changes Dec 10, 2021
Copy link

@brynbodayle brynbodayle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff!

@bryankeller
Copy link
Contributor Author

Merging now that CI is fixed (and passing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants