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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM