UIPageViewControler从didFinishAnimating方法获取当前的数字页面?

时间:2015-01-26 12:07:48

标签: objective-c uipageviewcontroller

有一种方法可以从这个方法中获取我当前的页面吗?

-(void)pageViewController:(UIPageViewController *)pvc didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed –

1 个答案:

答案 0 :(得分:0)

这对我有用,感谢Krumelur!

- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed 
{
   if (completed) {
    int currentIndex = ((UIViewController *)[self.pageViewController.viewControllers objectAtIndex:0]).view.tag;
    self.pageControl.currentPage = currentIndex;
     }
  }