I have a UICollectionViewController that uses the standard UICollectionViewFlowLayout to display a single vertical column of cells. I am trying to create an expand / collapse animation on a cell while listening to a cell. For this, I use the following code:
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath (NSIndexPath *)indexPath { [self.feedManager setCurrentlySelectedCellIndex:indexPath.item]; [self.collectionView performBatchUpdates:nil completion:nil]; } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
The 'selectedCellIndex' property on my control object tells the data models to return the expanded or collapsed size inside the heightForCellAtIndexpath:
[self.collectionView performBatchUpdates:nil completion:nil];
Then, the performBatchUpdates:completiong: method perfectly animates this resize. However! When an animation occurs, an expanding cell may cause a partially visible cell at the bottom of the screen to exit the screen.
If this is the case, and I subsequently destroy this cell, the cell will now be off-screen anchored to its old position without animation, while all other visible cells are waiting as desired. My intuition says that this is the correct behavior, since the cell is turned off when the collapse animation is performed, and it is not included in the animation rendering process. My question becomes, how can I prevent this?
I would prefer that all cells come to life together, regardless of whether they are off-screen or not. Any thoughts?
ios animation uicollectionview flowlayout
Cory Breed Jun 04 '13 at 2:54 on 2013-06-04 02:54
source share