Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selectItem error! #375

Open
ChoshimWy opened this issue Jan 5, 2024 · 2 comments
Open

selectItem error! #375

ChoshimWy opened this issue Jan 5, 2024 · 2 comments

Comments

@ChoshimWy
Copy link

Calling selectItem immediately after reloadData will crash

Thread 1: "Attempted to scroll the collection view to an out-of-bounds item (4) when there are only 0 items in section -1. Collection view: <FSPagerViewExample.FSPagerCollectionView: 0x10380ea00; baseClass = UICollectionView; frame = (0 0; 0 0); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x280105a40>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x280fcb7e0>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; layout: <FSPagerViewExample.FSPagerViewLayout: 0x102b04a90>; dataSource: <FSPagerViewExample.FSPagerView: 0x102b0e560; frame = (0 70; 1080 556); autoresize = RM+BM; layer = <CALayer: 0x280fcb440>>>."

@ParmarKrishna
Copy link

Can you provide steps to re-produce?

@peterhoucll
Copy link

peterhoucll commented May 20, 2024

Hi, I have also encountered this issue, refer to the following steps to reproduce the problem.

  1. Download FSPagerView own example
  2. Add the following code to TransformerExampleViewController:
override func viewDidLoad() {
        super.viewDidLoad()
        
        pagerView.reloadData()
        pagerView.selectItem(at: 2, animated: false)
}
  1. run the project, click on Transformer Example and it will crash, then you will see the crash message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants