4

I'm trying to implement a layout transition between two collection view controllers using the iOS 7+ property useLayoutToLayoutNavigationTransitions. I've a cell built in IB that is using auto layout. The two collection view controllers share the same data source, the only difference is the collection view layout used. In the prepareForSegue:sender: method I'm setting the property to YES just before pushing the other view controller as you can see here:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
   DetailViewController *controller = segue.destinationViewController;
   controller.useLayoutToLayoutNavigationTransitions = YES;
}

The result is that the animation is not as expected. The cell frame animates properly from the old size to the new size but the content of the cell goes immediately to the final position and so it's not following the resizing as you can see in the following video, where the constraints of the pink square are center vertically and horizontally in the superview.

enter image description here

If I disable auto layout in the storyboard and I redesign my prototype cell with the old springs and struts, the animation is smooth. Unfortunately, I need auto layout so I'm wondering if there is something that I should do and that I'm missing.

I've attached a simple prototype project (about ten lines of code were written) so that you can test it yourself.

https://dl.dropboxusercontent.com/u/1386166/CollectionViewTransition.zip

Luca Torella
  • 7,094
  • 4
  • 35
  • 47

0 Answers0