Reset scroll on UICollectionView

前端 未结 9 1333
太阳男子
太阳男子 2021-01-30 05:25

I have a horizontal UICollectionView which works fine and scrolls. When I tap an item I update my data and call reloadData. This works and the new data

9条回答
  •  太阳男子
    2021-01-30 05:50

    CGPointZero in my case shifted the content of the collection view because you are not taking in count the content inset. This is what it worked for me:

        CGPoint topOffest = CGPointMake(0,-self.collectionView.contentInset.top);
        [self.collectionView setContentOffset:topOffest animated:YES];
    

提交回复
热议问题