I have two UICollectionView
objects, that both have different source and delegate. I would like to achieve a "Photos app'esque" look with the transition, using UseLayoutToLayoutNavigationTransitions.
It doesn't work though. When I call the UseLayoutToLayoutNavigationTransitions
it changes the layout, but not the content.
First picture is first collection view. A series of categories and the people contained in them.
Second picture is what I'd like the animation to end up in. A series of people within a certain category.
Last picture is what happens right now. Categories just get rearranged.
Your problem is that during the transition iOS will change the datasource. See my answer to this question How to use useLayoutToLayoutNavigationTransitions in UICollectionView?
You can use the same pattern described there:
UseLayoutToLayoutNavigationTransitions
to get the layout changesHave a look at http://www.objc.io/issue-12/collectionview-animations.html in the
section.
it basically shows you that you'll have to change the datasource and delegate manually by implementation of the navigation controller delegate methods: