Change title of UINavigationController when UIPageViewController changes
I had to do exactly this in the app I'm currently working on.
First ensure you have set self.pageViewController.delegate to self.
Here's what I did:
// Notice when the pageviewcontroller finishes animating between pages.
- (void)pageViewController:(UIPageViewController *)pageViewController
didFinishAnimating:(BOOL)finished
previousViewControllers:(NSArray *)previousViewControllers
transitionCompleted:(BOOL)completed {
// .viewControllers[0] is always (in my case at least) the 'current' viewController.
UIViewController* vc = self.pageViewController.viewControllers[0];
self.navigationItem.title = vc.navigationItem.title;
}
The 'secret' is that (at least in the simple swipe-left-right case with full-screen sized pages I have) that self.pageViewController.viewControllers[0] is the 'current' page.
To use your property rather than the navigationItem title, then just change the last line to something like self.navigationItem.title = ((MyViewController*)vc).myProperty;