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