我想知道为 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 上是否有属性,或者有更好更标准的方法来做这样的事情。谢谢。