UIPageViewController: get the currentPage

后端 未结 12 551
别那么骄傲
别那么骄傲 2021-02-03 22:22

I have been struggling with this issue for the last few days and after all this juggling I have figured out that all I need is the current Index from the datasource method to up

12条回答
  •  难免孤独
    2021-02-03 22:58

    To get the current index you'll have to do the following:

    -(void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed {
    
    
       NSUInteger index = [self.viewControllers indexOfObject: [pageViewController.viewControllers lastObject]];
    
       NSLog(@"INDEX: %lu",(unsigned long)index);
    
    }
    

提交回复
热议问题