【发布时间】:2013-09-09 20:59:30
【问题描述】:
I would like to animate the reload of a collection view such that when a cell is selected I get an animation similar to dealing cards in a solitaire game. (想象旧的 MS 纸牌)
我搜索了“自定义 UICollectionView 重新加载动画”并看到了诸如
之类的解决方案[self.collectionView performBatchUpdates:^{
[self.collectionView reloadItemsAtIndexPaths:myindexPaths]
} completion:nil];
并想出了这个
CATransition *transition = [CATransition animation];
transition.duration = 1;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionMoveIn;
[self.collectionView.layer addAnimation:transition forKey:nil];
[self.collectionView reloadData];
return;
但这并没有达到我想要的效果。 有什么想法可以做到吗?
【问题讨论】:
-
为了实现这一点,您必须继承
UICollectionViewLayout。没有其他选择..
标签: ios uicollectionview uiviewanimation caanimation uicollectionviewlayout