TonyW
TonyW

Reputation: 18875

IGListKit: get the currently visible cell index

I am trying to use IGListKit (Link) in iOS to render custom collection view and table view, where I have a horizontal scrollview in a section controller. In this horizontal scrollview, I need to get the index of the currently visible cells.

I tried to use the displayDelegate in the section controller, but it seems to me that the following delegate method is triggered only once when the section controller is initially loaded:

func listAdapter(_ listAdapter: IGListAdapter, willDisplay sectionController: IGListSectionController, cell: UICollectionViewCell, at index: Int)

So I was wondering if there's a way in IGListKit to get the index of the currently visible cells. Thanks!

Upvotes: 1

Views: 1881

Answers (2)

sagarthecoder
sagarthecoder

Reputation: 193

self.section provides the index of currently visible cell.

Upvotes: 0

ThroughKim
ThroughKim

Reputation: 21

Did you checked IGListAdapter's Visible Objects and Visible SectionController functions?

https://instagram.github.io/IGListKit/Classes/IGListAdapter.html#/c:objc(cs)IGListAdapter(im)visibleSectionControllers

Upvotes: 2

Related Questions