FXPageControl icon indicating copy to clipboard operation
FXPageControl copied to clipboard

How to change page programatically?

Open hagile opened this issue 9 years ago • 1 comments

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!

hagile avatar Mar 26 '15 13:03 hagile

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

gohjohn avatar Jul 24 '15 06:07 gohjohn