页面控制器和导航栏

Posted

技术标签:

【中文标题】页面控制器和导航栏【英文标题】:UiPageController and NavigationBar 【发布时间】:2014-01-03 13:02:33 【问题描述】:

我的问题是没有在我的控制器中显示第一个视图的导航栏标题。 对于下一个项目,文本正在显示。 我的代码:

ViewControllerEvent *initialViewController = [self viewControllerAtIndex:self.index];
NSArray *viewControllers = [NSArray arrayWithObject:initialViewController];
[self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];

和 ViewController 代码:

- (void)viewDidAppear:(BOOL)animated
    self.navigationController.navigationBar.topItem.title = [self.event objectForKey:@"name"];

【问题讨论】:

【参考方案1】:

试试这个

- (void)viewDidAppear:(BOOL)animated
    [super viewDidAppear:animated];
    self.navigationController.title = [self.event objectForKey:@"name"];

【讨论】:

以上是关于页面控制器和导航栏的主要内容,如果未能解决你的问题,请参考以下文章