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;
          }];

     }];
  • 使用batchperforming设置我的第一个集合视图的动画
  • 完成后,设置第二个集合视图的动画
  • 问题是第二次执行非常慢(比如动画前5秒或更长时间),而第一次执行是立即执行的,比如它的完成调用

    我甚至试着分别这样做:

        [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在多次调用时将自身(甚至在不同的对象上)排队