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
Post a Comment