Iglistkit: Help with scroll(to:..)

Created on 16 May 2017  ·  7Comments  ·  Source: Instagram/IGListKit

New issue checklist

General information

  • IGListKit version: last
  • iOS version(s): 9.1-now
  • CocoaPods/Carthage version: last
  • Xcode version: last
  • Devices/Simulators affected:
  • Reproducible in the demo project? (Yes/No):
  • Related issues:

So I have a IGListCollectionView that looks like UIPageViewController (horizontal scroll, paging enabled), I need to show the last cell when app loads. How can I do that?

question

Most helpful comment

Yes, we are. Thanks a lot.

От 16 May 2017 в 18:13:38, James Sherlock ([email protected])
написал:

You state that you're using the "last" (assuming latest) version of
IGListKit, but as per the discussion here
https://github.com/Instagram/IGListKit/issues/409 the IGListCollectionView
has been removed in version 3.0!

Regardless IGListCollectionView was just a small wrapper of UICollectionView
providing some warnings/errors when you tried to use certain methods. You
should be able to scroll the same way you would if it was just a
UICollectionView using the scrollToItem(at: indexPath) method like:

collectionView.scrollToItem(at: IndexPathOfLastItem, at:
.centeredHorizontally, animated: false)

Does this help?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Instagram/IGListKit/issues/743#issuecomment-301762978,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJr626-0d6esYfd94tkge1mGhRceC-fEks5r6ZLygaJpZM4NcWWs
.

All 7 comments

You state that you're using the "last" (assuming latest) version of IGListKit, but as per the discussion here the IGListCollectionView has been removed in version 3.0!

Regardless IGListCollectionView was just a small wrapper of UICollectionView providing some warnings/errors when you tried to use certain methods.

You should be able to scroll the same way you would if it was just a UICollectionView using the scrollToItem(at: indexPath) method like:

collectionView.scrollToItem(at: IndexPathOfLastItem, at: .centeredHorizontally, animated: false)

Does this help?

Thanks @Sherlouk, one more question, how do I find an IndexPath for last item? I've tried few methods, but nothing has helped me :(

Well that will depend on your exact setup, but you just need to construct an IndexPath based on the size of your collection view.

Assuming you follow IGListKit recommendations and have many sections, then you _could_ do something like this:

IndexPath(item: 0, section: collectionView.numberOfSections)

@Sherlouk Thanks a lot!

We good to close this issue @folexz?

Yes, we are. Thanks a lot.

От 16 May 2017 в 18:13:38, James Sherlock ([email protected])
написал:

You state that you're using the "last" (assuming latest) version of
IGListKit, but as per the discussion here
https://github.com/Instagram/IGListKit/issues/409 the IGListCollectionView
has been removed in version 3.0!

Regardless IGListCollectionView was just a small wrapper of UICollectionView
providing some warnings/errors when you tried to use certain methods. You
should be able to scroll the same way you would if it was just a
UICollectionView using the scrollToItem(at: indexPath) method like:

collectionView.scrollToItem(at: IndexPathOfLastItem, at:
.centeredHorizontally, animated: false)

Does this help?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Instagram/IGListKit/issues/743#issuecomment-301762978,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJr626-0d6esYfd94tkge1mGhRceC-fEks5r6ZLygaJpZM4NcWWs
.

Thanks @Sherlouk !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

krysztalzg picture krysztalzg  ·  3Comments

lucabartoletti picture lucabartoletti  ·  3Comments

drinkius picture drinkius  ·  3Comments

kanumuri9593 picture kanumuri9593  ·  3Comments

joseph-francis picture joseph-francis  ·  3Comments