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

How to change page programatically? #12

Open
hagile opened this issue Mar 26, 2015 · 1 comment
Open

How to change page programatically? #12

hagile opened this issue Mar 26, 2015 · 1 comment

Comments

@hagile
Copy link

hagile commented Mar 26, 2015

Is there a way to change page programatically? For e.g. I've 10 pages and I'm viewing 2nd page right now, now if I want to jump to 6th page, is it possible? Thanks!

@gohjohn
Copy link

gohjohn commented Jul 24, 2015

The page for FXPageControl can be changed like so:

self.fxPageControl.currentPage = newIndex;

If you are talking about changing your current page for your UIPageViewController when the user touches the fxPageControl, then do this:

  • (IBAction)pageControlValueChanged:(FXPageControl *)sender {
    int newIndex = sender.currentPage;
    UIPageViewControllerNavigationDirection direction = (newIndex > currentIndex)? UIPageViewControllerNavigationDirectionForward:UIPageViewControllerNavigationDirectionReverse;
    [self.pageController setViewControllers:@[[self viewControllerAtIndex:newIndex]] direction:direction animated:YES completion:nil];
    }

You will need to connect the IBAction to the Value Changed Event of the FXPageControl

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

2 participants