-
Notifications
You must be signed in to change notification settings - Fork 50
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
the current page is not exactly right #12
Comments
Unable to reproduce. I can't scroll over page1.
|
I think it has nothing to do with Os or Device And i have work on the same problem about using UIPageViewController to do this.also see some other app that do this,both of them have the same problem more or less. |
The problem seems to be this and the solution provided is not what I want to implement. A possible solution could be to set the selected tab before the transition actually finishes. So instead of setting it in - (void)pageViewController:(UIPageViewController *)viewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed {
if (completed){
[self.pageControl setSelectedSegmentIndex:[self.pages indexOfObject:[viewController.viewControllers lastObject]] animated:YES];
}
} I'll push a solution that does it like this - (void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray *)pendingViewControllers {
[self.pageControl setSelectedSegmentIndex:[self.pages indexOfObject:[pendingViewControllers lastObject]] animated:YES];
} |
Well, its a good try, i have also done this before. Yes, do the page change in the But there is another page error when quick scroll left and right, (with two fingers to make the continuously drag) and the reproduction is much more complecatied:
It happens because when drag with two fingers to make the continuously scroll, the willTransitionToViewControllers is not called correctly. |
So I'll probably need to combine |
Maybe, i have tried this with no solution. Have a try,and i am glad to discuss with you~~ |
Last night I made some tests and it seems like I need to set the pager index in - (void)pageViewController:(UIPageViewController *)viewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed {
if (!completed) {
[self.pageControl setSelectedSegmentIndex:[self.pages indexOfObject:[viewController.viewControllers lastObject]] animated:YES];
}
} Drawback: The Pager is set before it is really needed which will trigger the delegate methods of the control |
Actually even that one was not working, so I checked this solution with a couple of hacks and I hope it works now |
Yeah, i have see the solution either, but i did not have a try. i just don't want to get it through this way, as you know its more or less dirty, and may not work in the future. |
follow this:
page 2
page 1
,but not leave your finger, until overpage 1
, which means you have see the background color.You will see the view controller is
page 1
,but the top bar still stoped withpage 2
The text was updated successfully, but these errors were encountered: