Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom animation when switching from one UICollectionViewLayout to another?
    primarykey
    data
    text
    <p>As a test I made one layout that displays cells in a vertical line and another that displays them in a horizontal layout. When I call <code>[collectionView setCollectionViewLayout:layout animated:YES];</code> it animates between the two positions very cleanly.</p> <p>Now that I'd <em>like</em> to do is have all the views do a few spins, warps and flips around the screen (probably using CAKeyframeAnimations) before finally arriving at their destination, but I can't find a good place to hook this in.</p> <p>I tried subclassing <code>UICollectionViewLayoutAttributes</code> to contain an animation property, then setting those animations in an overridden <code>applyLayoutAttributes:</code> method of the <code>UICollectionViewCell</code> I'm using. This works... EXCEPT it appears to happen only <em>after</em> the layout transition is complete. If I wanted to use this, I'd have to have the layout not change the current positions of the objects right away, only after the it reaches this apply attributes part of the code, and that seems like a lot of work...</p> <p>Or I could subclass <code>UICollectionView</code> and override <code>setCollectionViewLayout:animated:</code>, but that also seems like a lot of state to keep around between layouts. Neither of these optins seems right, because there's <em>such</em> an easy way to animate additions/deletions of cells <em>within</em> a layout. I feel like there should be something similar for hooking into the animations <em>between</em> layouts. </p> <p>Does anyone know the best way to get what I'm looking to accomplish?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload