반응형
How to add pull to refresh on collectionview?
Pull to refresh is often used in lists.
It's not hard to add pull to refresh on collectionview.
You can use UIRefreshControl to implement it.
Set collectionview refreshControl.
You can custom refreshControl color by tintColor property, size by scale and you can even set title.
And implement selector function.
You should call your data refresh function inside it.
And after load data, call endRefreshing() to hide refreshControl.
Noted)
When collectionview is empty, refresh function might not called.
Because collectionview is not scrolled.
In that case, just set alwaysBounceVertical or alwaysBounceHorizontal property to true.
Happy codding :)
반응형
그리드형
'개발 > swift' 카테고리의 다른 글
How to make custom keyboard? (0) | 2021.04.12 |
---|---|
How to change UITextField placeholder color? (0) | 2021.03.05 |
Swift scene delegate vs app delegate (0) | 2020.12.16 |
Swift How to init keychain when app deleted? (0) | 2020.12.12 |
Swift How to ignore return value? (0) | 2020.12.08 |