我的问题是没有显示控制器中第一个视图的导航栏标题。 对于下一个项目显示文本。 我的代码:
ViewControllerEvent *initialViewController = [self viewControllerAtIndex:self.index];
NSArray *viewControllers = [NSArray arrayWithObject:initialViewController];
[self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
和View Controller代码:
- (void)viewDidAppear:(BOOL)animated{
self.navigationController.navigationBar.topItem.title = [self.event objectForKey:@"name"];
}
答案 0 :(得分:0)
试试这个
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
self.navigationController.title = [self.event objectForKey:@"name"];
}