I'm trying to get a handle on new iOS 7 APIs that allow for interactive, animated view controller transitions, including transitions between UICollectionViewLayout
s.
I've taken and modified sample code from WWDC 2013, "iOS-CollectionViewTransition", which can be found here: https://github.com/timarnold/UICollectionView-Transition-Demo
The original demo, which was not in a working state when I found it, can be accessed with an Apple Developer account, here: https://developer.apple.com/downloads/index.action?name=WWDC%202013
My version of the app presents a collection view with two layouts, both UICollectionViewFlowLayout
layouts with different properties.
Tapping on a cell in the first layout properly animates to the second, including, crucially, the tapped-on-item being scrolled to in the new layout. At first I was confused about how the new collection view knows to set its content offset so that the appropriate cell is visible, but I learned it does this based on the selected
property of the presenting collection view.
Pinching on an item in the first layout should animate, using UICollectionViewTransitionLayout
, UIViewControllerAnimatedTransitioning
, and UIViewControllerInteractiveTransitioning
, to the new layout as well. This works, but the pinched-at cell is not scrolled to in the new layout or the transition layout.
I've tried setting the selected
property on the pinched-on cell at various locations (to try to mimic the behavior described when tapping on an item to push the new view controller), to no avail.
Any ideas about how to solve this problem?