Search code examples
iosobjective-cuiscrollviewuipagecontrol

UIPageControl customization


I'm trying to make something like UIPageViewController where I can swipe between different VC's. But instead of custom dot control I need to have custom buttons. So that either user can select different VC with button click or can swipe.

Right now I'm using UIScrollView to make this. I don't know how to proceed with buttons so I need help with that.

Is there any custom control that'll be useful for this?


Solution

  • You can do it in different ways. If you have three pages, you can create a UI with three buttons(or a tab bar) and in the action you can call:

    [self.pageViewController setViewControllers:@[[self viewControllerAtIndex:YourPageIndex]
                                      direction:UIPageViewControllerNavigationDirectionReverse
                                       animated:YES
                                     completion:nil];
    

    UIPageViewControllerNavigationDirectionReverse or UIPageViewControllerNavigationDirectionForward can be used as required.

    This is how we do it.

    Or you can use any custom libraries: Carbon kit is a working library. Here you can find many of them.

    OR TRY THIS( a simpler example on carbon kit )