In my application I have a RootViewController (UIPageViewController), a FirstController (UIViewController) and a SecondController (UIViewController). The two views inside the two UIViewControllers scroll over the RootViewController.
In my RootViewController.h:
@interface RootController : UIPageViewController <UIPageViewControllerDataSource, UIPageViewControllerDelegate>
But when I scroll between different views delegate methods like:
-(void) pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed
are not called. Why? Can someone help me? Thank you in advance.
Did you assign rootViewController (whichever controller/object you want to receive the delegate calls) to be the delegate/datasource of the UIPageViewController?
pageViewController.delegate = rootViewController;
pageViewController.dataSource = rootViewController;
In addition to the obvious solution above, if you are encountering this issue please consider the possibility that the PageViewController itself is not being retained. I made the mistake earlier this evening of instantiating a PageViewController and adding its view as a subView but not retaining the pageViewController itself.
Make sure to retain it either by adding it as a childViewController or assigning it to a strong property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With