【发布时间】:2012-10-07 00:43:06
【问题描述】:
我有一个自定义流布局,当单元格从 CollectionView 插入和删除时,它使用以下两个函数调整它们的属性,但我无法弄清楚如何调整默认动画持续时间。
- (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingItemAtIndexPath:(NSIndexPath *)itemIndexPath {
UICollectionViewLayoutAttributes* attributes = [self layoutAttributesForItemAtIndexPath:itemIndexPath];
// Assign the new layout attributes
attributes.transform3D = CATransform3DMakeScale(0.5, 0.5, 0.5);
attributes.alpha = 0;
return attributes;
}
- (UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingItemAtIndexPath:(NSIndexPath *)itemIndexPath {
UICollectionViewLayoutAttributes* attributes = [self layoutAttributesForItemAtIndexPath:itemIndexPath];
// Assign the new layout attributes
attributes.transform3D = CATransform3DMakeScale(0.5, 0.5, 0.5);
attributes.alpha = 0;
return attributes;
}
【问题讨论】:
-
根据苹果的文档,“当动画布局发生变化时,动画时间和参数由集合视图控制。”这是参考 setCollectionView:animated: 方法,但我怀疑修改集合视图的边界也是如此。抱歉,我无法提供更多帮助,我遇到了同样的问题。我怀疑答案就在 UICollectionView 对象本身的某个地方。
标签: ios ios6 grid collectionview