swift - How to move to the selected cell in UiCollectionView -


i'm newbie in swift, please bear me.

i have created uicollectionview scrolls horizontally, question is: how can move selected icon programmatically?

i have used didselectedpath, whats next?

you need call scrolltoitematindexpath function:

scrolls collection view contents until specified item visible.

 func scrolltoitematindexpath(_ indexpath: nsindexpath,                 atscrollposition scrollposition: uicollectionviewscrollposition,                         animated animated: bool) 

parameters

indexpath

the index path of item scroll view.

scrollposition

an option specifies item should positioned when scrolling finishes. list of possible values, see uicollectionviewscrollposition.

animated

specify true animate scrolling behavior or false adjust scroll view’s visible content immediately.

check uicollectionview class reference more info.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -