Ios 多个UICollectionView性能更新
我正在用自定义布局和流程在Ios 多个UICollectionView性能更新,ios,objective-c,animation,uicollectionview,Ios,Objective C,Animation,Uicollectionview,我正在用自定义布局和流程在UICollectionView中制作一些动画 当我想为我的UICollectionViews设置动画时,我会这样做: [localCollectionView performBatchUpdates:^{ [localCollectionView insertItemsAtIndexPaths:indexPaths]; } completion:^(BOOL finished) { [localLabelColle
UICollectionView
中制作一些动画
当我想为我的UICollectionView
s设置动画时,我会这样做:
[localCollectionView performBatchUpdates:^{
[localCollectionView insertItemsAtIndexPaths:indexPaths];
} completion:^(BOOL finished) {
[localLabelCollectionView performBatchUpdates:^{ //problem here
[localLabelCollectionView insertItemsAtIndexPaths:indexPaths];
} completion:^(BOOL finished) {
hatching = NO;
}];
}];
[localCollectionView performBatchUpdates:^{
[localCollectionView insertItemsAtIndexPaths:indexPaths];
} completion:^(BOOL finished) {
}];
[localLabelCollectionView performBatchUpdates:^{ //problem here
[localLabelCollectionView insertItemsAtIndexPaths:indexPaths];
} completion:^(BOOL finished) {
hatching = NO;
}];
同样的问题也出现了。欢迎提出任何建议或解释
附言:
第一个解决方案,对我来说,必须工作,因为只使用主UI线程进行动画。这就是为什么我认为第二个示例(没有处理最糟糕的UI动画)无法工作的原因。就是这样做的,并且工作起来像一个魔咒:
[localCollectionView performBatchUpdates:^{
[localCollectionView insertItemsAtIndexPaths:indexPaths];
[localLabelCollectionView insertItemsAtIndexPaths:indexPaths];
} completion:^(BOOL finished) {
hatching = NO;
}];
似乎performBatch update在多次调用时会自动排队(即使在不同的对象上)。就是这样做的,工作起来就像一个魔咒:
[localCollectionView performBatchUpdates:^{
[localCollectionView insertItemsAtIndexPaths:indexPaths];
[localLabelCollectionView insertItemsAtIndexPaths:indexPaths];
} completion:^(BOOL finished) {
hatching = NO;
}];
似乎performBatch update在多次调用时将自身(甚至在不同的对象上)排队