我有一個自定義的流佈局,正在調整單元格的屬性,當它們被插入並從以下兩個函數從CollectionView中刪除,但我無法弄清楚如何調整默認動畫持續時間。如何設置UICollectionView動畫的持續時間?
- (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對象本身的某處。 – Ash