Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current view controller in page view controller

I want to get the current view controller at present in page view controller. how it can be done. Does it have some delegate to call or what.

like image 549
iPhone Programmatically Avatar asked Dec 14 '12 11:12

iPhone Programmatically


1 Answers

I just had the same problem. Looks like the current controller is last in the list after you did change the page. This worked for me, but I don't know if it's always true.

- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed
{
    UIViewController *vc = [pageViewController.viewControllers lastObject];
}
like image 121
CodeStage Avatar answered Oct 06 '22 01:10

CodeStage