UICollectionView在iOS中删除单元格的animation时间

我正在使用集合视图为第一次我需要删除点击集合视图单元格,这是适合我的工作。但我挣扎着UIcollectionview的animation时间。它总是相同的。我怎样才能增加或减less删除单元格的animation时间。我也把这个代码在uianimation块,但它不工作。 这是我的代码删除,任何意见将不胜感激。

[self.collectionView performBatchUpdates:^{ NSArray* itemPaths = [self.collectionView indexPathsForSelectedItems]; // Delete the items from the data source. [self deleteItemsFromDataSourceAtIndexPaths:itemPaths]; // Now delete the items from the collection view. [self.collectionView deleteItemsAtIndexPaths:tempArray } completion:nil]; 

 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath 

在上面的委托方法中,执行以下操作:

 NSIndexPath *lIndexPath = [NSIndexPath indexPathForRow:indexPath.row inSection:0]; UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:lIndexPath]; //Perform flip animation //_AnimationDuration defined in Constant.h CGContextRef context = UIGraphicsGetCurrentContext(); context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationDuration:_AnimationDuration]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:cell cache:YES]; [UIView commitAnimations]; //Implementation of GCD to delete a flip item double delay = _AnimationDuration/2; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC); dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ //code to be executed on the main queue after delay [self deleteContent:indexPath]; }); -(void) deleteContent:(NSIndexPath *)_indexPath{ //Remove items from array on delete [itemArr removeObjectAtIndex:_indexPath.row]; //Reload the items of UICollectionView performBatchUpdates Block [self.collectionView performBatchUpdates:^{ [self.collectionView deleteItemsAtIndexPaths:@[_indexPath]]; } completion:nil]; }