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

When scrolling, sometimes a viewcontroller would get skipped (index not consistent) #172

Open
gabuchan opened this issue Sep 3, 2018 · 5 comments

Comments

@gabuchan
Copy link

gabuchan commented Sep 3, 2018

So basically the view that I'm creating shows the history of actions that a user did in the past with two viewing modes: monthly and yearly. I'm using the same PageboyViewControllerDelegate with these two modes and I'm locally tracking the "current index" for each viewing mode (when the user changes the viewing mode it would show the according month or year that he was previously seeing).

It was working perfectly under version 2.2.0 but it seemed to have broken somewhere when I tried updating to 2.5.4 (basically any version from 2.3.4). What happens here is that at function:

func pageboyViewController(_ pageboyViewController: PageboyViewController,
                           willScrollToPageAt index: Int,
                           direction: PageboyViewController.NavigationDirection,
                           animated: Bool)

if the array of viewcontrollers is, let's say 9, the index argument would start from the end (as originally set, so 8), and would jump directly to 6, then would normally continue 5-4-3-etc...
And when scrolling back, index would skip again the number 7 for some random reason until I slowly scroll in it and kind of bruteforce the animation for the 7th viewcontroller to show. As a note I'm not changing any internal value of it and it only happen with that screen.

Am I missing something trivial here?

Thanks so much in advance!

@msaps
Copy link
Member

msaps commented Sep 3, 2018

@gabuchan sounds like a weird one! Had a quick play and I can't seem to reproduce it in the example project, would you be possibly able to supply a demo that reproduces it or video the behaviour (maybe with logs)?

For context: willScrollToPageAt is called at the mercy of the internal UIPageViewController, basically whenever that fires its willTransitionTo pendingViewControllers delegate function, the Pageboy delegate is called.

@gabuchan
Copy link
Author

gabuchan commented Sep 5, 2018

Thanks for the super quick reply!
Here's a small video showing what I was trying to explain earlier:
pageboy example_low.zip

Apologies I omitted the logs but they basically are what the video reflects: it prints the actual index of the viewcontroller array and skips one. So when switching to Yearly mode (the array is [2010...2018] ) it goes:

8
6
8
6
8
6
5
4
etc...

I'm printing the given index from func pageboyViewController(_.... willScrollToPageAt.....)

Hope this helps!

@msaps
Copy link
Member

msaps commented Sep 6, 2018

@gabuchan I take it you are using Tabman with this? It somehow looks like the number of items in the TabmanBar falls out of sync with what is in the PageboyViewControllerDataSource. Would you maybe be able to take a look into this and see what the results are??

@gabuchan
Copy link
Author

gabuchan commented Sep 7, 2018

@msaps Negative, not using Tabman. Just plain Pageboy and custom views.
Since I'm not updating any internal Pageboy variable I don't know where the problem can come from...

I'm still looking into it a bit more but it's weird that in past versions this problem isn't happening...

@msaps
Copy link
Member

msaps commented Sep 12, 2018

@gabuchan okay cool, will investigate further and see what I can find. Does sound odd that it used to be fine in previous versions!

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

No branches or pull requests

2 participants