Reset scroll on UICollectionView

前端 未结 9 1262
太阳男子
太阳男子 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:39

    You want setContentOffset:. It takes a CGPoint as and argument that you can set to what ever you want using CGPointMake, but if you wish to return to the very beginning of the collection, you can simply use CGPointZero.

    [collectionView setContentOffset:CGPointZero animated:YES];
    

提交回复
热议问题