custom animation in setCollectionViewLayout:animated: to enlarge the selected cell

1k views Asked by At

I'm changing layouts when selecting a cell in a uicollectionview and have added a custom animation to the collectionview layer

currently I'm using this code:

[self.collectionView performBatchUpdates:^{
            CATransition *transition = [CATransition animation];
            transition.duration = 0.5f;
            transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
            transition.type = kCATransitionMoveIn;
            [self.collectionView.layer addAnimation:transition forKey:nil];
            [self.collectionView setCollectionViewLayout:self.horizontalPagingLayout animated:NO];
            self.galleryInHorizontalScrollMode = YES;
            [self.collectionView setPagingEnabled:YES];
        } completion:^(BOOL finished) {
            [self reloadData];
        }];

I would like to change the animation style (transition.type) such that the selected cell will "grow" (or shrink) to the size of the final cell size defined in the collectionview layout

How can this be done?

I've tried solutions as suggested here but they looked very poor

0

There are 0 answers