KelvinJin / AnimatedCollectionViewLayout

A UICollectionViewLayout subclass that adds custom transitions/animations to the UICollectionView without effecting your existing code.
MIT License
4.74k stars 350 forks source link

How to adjust collectionView Cell size appropriately when in landscape? #49

Closed JayceBryce closed 5 years ago

JayceBryce commented 5 years ago

I'm using your current projects master branch. When I run the project the Parallax Collection view in portrait it looks great. The issue is when I turn it landscape the cells do not resize property( The experience should be the same as portrait - only one cell showing). Could you please fix this issue on a separate branch? Thank you!

Here is an image illustrating the issue:

Parallax-Image

KelvinJin commented 5 years ago

Hey, you'll need to change scrollDirection to horizontal when rotate to landscape...

JayceBryce commented 5 years ago

Currently it is set to horizontal. When I flip the phone to landscape it remains .horizontal but everything seems to break like the image above. Am I misunderstanding something? Thanks

        let layout = AnimatedCollectionViewLayout()
        layout.scrollDirection = .horizontal
        layout.animator = ParallaxAttributesAnimator()
        collectionView.collectionViewLayout = layout

To test this just simply run your project and flip the phone to landscape mode.

JayceBryce commented 5 years ago

Just reaching back out since I still have not heard back from you. Thanks

KelvinJin commented 5 years ago

This issue is again not related to this library at all. You'll need to call collectionViewLayout.invalidateLayout() in viewWillTransition. You can find plenty of answers in StackOverflow. And you might also need to fix the issue caused by contentOffset after rotation which is another issue.

I suggest you try without using AnimatedCollectionViewLayout first and see if it's an issue with the library itself before posting any issue.

boominadhaprakash commented 5 years ago

Hi @JayceBryce Have you fixed that issue. I am also facing that.

OsamaMukhtar commented 4 years ago

Same issue here