【发布时间】:2015-12-09 09:38:58
【问题描述】:
我正在UICollectionView 中使用自定义布局和流程制作一些动画。
当我想为我的UICollectionViews 设置动画时,我正在这样做:
[localCollectionView performBatchUpdates:^{
[localCollectionView insertItemsAtIndexPaths:indexPaths];
} completion:^(BOOL finished) {
[localLabelCollectionView performBatchUpdates:^{ //problem here
[localLabelCollectionView insertItemsAtIndexPaths:indexPaths];
} completion:^(BOOL finished) {
hatching = NO;
}];
}];
- 使用批处理为我的第一个集合视图制作动画
- 完成后,为我的第二个集合视图设置动画
问题是当第一次立即执行时,第二次执行真的很慢(比如动画前 5 秒或更长时间),就像它的完成调用一样。
我什至试着像这样分开做:
[localCollectionView performBatchUpdates:^{
[localCollectionView insertItemsAtIndexPaths:indexPaths];
} completion:^(BOOL finished) {
}];
[localLabelCollectionView performBatchUpdates:^{ //problem here
[localLabelCollectionView insertItemsAtIndexPaths:indexPaths];
} completion:^(BOOL finished) {
hatching = NO;
}];
出现同样的问题。欢迎任何建议或解释。
附:
对我来说,第一个解决方案必须工作,因为只使用主 UI 线程进行动画处理。这就是为什么我认为第二个示例(不处理最糟糕的 UI 动画)无法工作的原因。
【问题讨论】:
标签: ios objective-c animation uicollectionview