3

I want to insert sections at the beginning of the UICollectionView like so

[self.collectionView performBatchUpdates:^{
    [self.collectionView insertSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 12)]];
} completion:nil];

If I do this the scroll view immediatetly scrolls to the top. I don't want this behavior/animation. The position should stay where it was before the sections were added. This should also be the case if the user is currently scrolling. He shouldn't notice that sections are inserted. Therefore I tried this answer.

He still scrolls to the top for a short period of time, before the content offset is correctly calculated and set by me. Doing this in a short sample does work fine (except one time), but in my project it behaves differently. Here the animation flickers through the jump of the content offset.

How can I find out who set's my content offset to the top? How can I surpress or circumvent this issue so that the UICollectionView holds it's position?

Community
  • 1
  • 1
testing
  • 19,681
  • 50
  • 236
  • 417

0 Answers0