UseLayoutToLayoutNavigationTransitions and Auto Layout

I am trying to implement a layout transition between two collection controllers using an iOS 7+ property useLayoutToLayoutNavigationTransitions

. I have a cell embedded in IB that uses auto layout. The two collection view controllers use the same data source, the only difference is that the collection layout is used. In the method, prepareForSegue:sender:

I set the property YES

before pushing another view controller, as you can see here:

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

      

As a result, the animation is not as expected. The cell frame animates correctly from the old size to the new size, but the cell content immediately jumps to the final position and therefore does not match the resize, as you can see in the following video where the pink square limits are centers vertically and horizontally in supervision.

enter image description here

If I turn off auto-layout in the storyboard, and I redesign my prototype cell with the old springs and struts, the animation is smooth. Unfortunately I need an auto-layout, so I'm wondering if there is something I should be doing that I am missing.

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

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

+3


source to share





All Articles