iOS collectionView返回顶部 / 滚动到指定位置

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

原文地址:https://www.cnblogs.com/qingzZ/p/13958647.html