Custom animation when switching from one UICollectionViewLayout to another?

#define degreesToRadians(x) (M_PI * (x) / 180.0)

UICollectionView *collectionView = self.viewController.collectionView;
HorizontalCollectionViewLayout *horizontalLayout = [HorizontalCollectionViewLayout new];
NSTimeInterval duration = 2;


[collectionView.visibleCells enumerateObjectsUsingBlock:^(UICollectionViewCell *cell, NSUInteger index, BOOL *stop)
 {
     CABasicAnimation *rotationAnimation;
     rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
     rotationAnimation.toValue = @(degreesToRadians(360));
     rotationAnimation.duration = duration;
     rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

     [cell.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
 }];

[UIView animateWithDuration:duration
                 animations:^
 {
     collectionView.collectionViewLayout = horizontalLayout;
 }];

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)