iOS collectionView返回顶部

1.
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
[collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionTop animated:true];



2.
[_collectionViewsetContentOffset:CGPointMake(0,0)animated:NO];

 

 

参考:

https://blog.csdn.net/saw471/article/details/53894174?utm_source=blogxgwz6

https://www.jianshu.com/p/c3b84f3bd56b?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

posted on 2020-11-11 14:49  懂事长qingzZ  阅读(2003)  评论(0编辑  收藏  举报