我想知道一种好的方法来为UICollectionView中的所有单元格添加动画。我正在尝试模拟对UICollectionView进行编辑的过程。因此,我想做的是缩小UICollectionViewCells的边界。我的代码如下:
- (IBAction)startEditingMode:(id)sender {
[_items enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:idx inSection:0];
UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath];
[UIView animateWithDuration:0.25 animations:^{
cell.layer.transform = CATransform3DMakeScale(0.9, 0.9, 1);
}];
}];
}
它可以工作,但我不确定UICollectionView上是否有属性,或者更好的更标准的方法来做这样的事情。谢谢。