title: UIPageControl - Change page on click of button
body: <p>I am using <code>UIPageControl</code> along with <code>UISwipeGestureRecognizer</code> to switch between view controllers. The pages are changed using swipe.</p>
  
  <p>I also need to change the page when a <code>UIButton</code> is pressed on one of the view controllers.</p>
  
  <p>Here is how the swipe is used to change the views:</p>
  
  <pre><code>- (void)swipeRightToLeftGesture:(UIGestureRecognizer *)gestureRecognizer {
      if (self.pageControl.currentPage == 0) { 
         [UIView animateWithDuration:1
                   animations:^{
  
                       for (UIViewController *vc in self.childViewControllers) {
                           CGRect frame = vc.view.frame;
                           frame.origin.x -= self.view.frame.size.height;
                           vc.view.frame = frame;
                   }
        }];
        self.pageControl.currentPage = 1;
     }
  }
  </code></pre>
  
  <p>I hope the question is clear. I tried my best to make it clear.</p>