How to reliably determine when UICollectionView layout has finished animating

I'm having problems figuring out a way to determine when UICollectionView is/has finished animating.

I currently have a UICollectionView that animates between two subclassed flow layouts using setCollectionViewLayout:animated:

The animation looks great, however, I'm having some undesired behaviour if a user selects a cell during the animation.

I'm looking at ignoring the cell 'selection' by returning NO through the UICollectionViewDelegate method collectionView:shouldSelectItemAtIndexPath: - however - I cannot figure out a reliable test to see if the collection view is currently animating.

Any ideas?


尝试检查是否没有动画键。
BOOL isAnimating = myView.layer.animationKeys.count > 0

链接地址: http://www.djcxy.com/p/14744.html

上一篇: 它是否是“javax”非法(保留)软件包名称?

下一篇: 如何可靠地确定UICollectionView布局何时完成动画