Reputation: 24426
I've got a UICollectionView using a flow layout.
Initially it shows small cells, roughly 5 X 5 on the iPad screen.
What I want to do it smoothly change to a nearly full screen cell size, with a cell with a larger, slightly different layout.
----------------
| |---| |---| |
| | | | | |
| |---| |---| |
| |
| |---| |---| |
| | | | | |
| |---| |---| |
----------------
transitions to..
----------------
| |---------| |
| | | |
| | | |
| | | |
| |---------| |
| |
| |---------| |
----------------
At the moment I use use a boolean showLarge
which I set to YES when the user clicks (didSelectItemAtIndexPath
)
Then I reload the data.
self.showLarge = YES;
[self.collectionView reloadData];
In my cellForItemAtIndexPath
I load the appropriate cell according to the boolean:
if (!self.showLarge)
{
SmallCell *smallCell ..
etc
return smallCell;
} else
{
LargeCell *smallCell ..
etc
return largeCell;
}
However, this is an abrupt transition.
How would I smoothly animate to the new custom UICollectionViewCell?
Upvotes: 0
Views: 180
Reputation: 25144
You could use a different UICollectionViewFlowLayout
, then change the collection view's layout on the fly. That'll give you a nice animation without the need to reload anything.
Upvotes: 2