UICollectionViewCell performBatchUpdates动画时间

Luc*_*tti 2 animation objective-c uikit ios uicollectionview

有一种方法可以自定义通过performBatchUpdates完成的动画的时间安排吗?

我有这个代码

[self.stepCollectionView performBatchUpdates:^{
    self.stepSelectedIndex = indexPath.row;

    UICollectionViewCell *cell = [self.stepCollectionView cellForItemAtIndexPath:indexPath];

    [UIView transitionWithView:cell
                      duration:0.5f
                       options: UIViewAnimationOptionLayoutSubviews | UIViewAnimationOptionBeginFromCurrentState
                    animations:^{
                        CGRect frame = cell.frame;
                        frame.size.height = 416;
                        cell.frame = frame;
                    }
                    completion:^(BOOL finished) {
                    }];
    } completion:^(BOOL finished) {        
}];
Run Code Online (Sandbox Code Playgroud)

我将更改UICollectionViewCell的高度,同时重新组织UICollectionViewCell的子视图.

Sri*_*san 5

有一种方法可以为UICollectionView的批量更新自定义持续时间和时间功能.请尝试以下代码.以下是它的外观https://youtu.be/R0VdC4dliPI

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];

[CATransaction begin];
[CATransaction setAnimationDuration:0.3];

[CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithControlPoints:0 :1.8 :0 :1]];

[self.menuCollectionView performBatchUpdates:^{
    [self.menuCollectionView insertItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:index inSection:0]]];
    [animatableMenuItems insertObject:@"" atIndex:index];
} completion:^(BOOL finished) {

}];

[CATransaction commit];
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)

在https://github.com/DoddaSrinivasan/MultiRowUITabBar上找到该示例的完整源代码