0

我有一个UINavigationController其中我推/显示其他几个UIViewControllers。无论导航控制器中显示的视图控制器是什么,我都想要在UINavigationControllerUINavigationBar中出现一个特定的标题和按钮(确切地说,取消按钮出现在右侧)。目前,我已将每个视图控制器的.title.navigationItem.rightBarButtonItem设置为相同,但这似乎是(a)大量浪费的工作;和(b)当一个新的视图控制器被推入堆栈时,有一个简短的动画,其中的标题和按钮可以看到动画出来,然后返回 - 显然不合意,因为我想表现出这些项目是静态的从不改变。UINavigationController标题和按钮

任何建议将不胜感激。

回答

1

尝试设置你在UINavigationController的需要,然后在你的UIViewControllers的viewWillAppear中的子类贴:

[self.navigationItem setLeftBarButtonItem:self.navigationController.navigationItem.leftBarButtonItem]; 
[self.navigationItem setRightBarButtonItem:self.navigationController.navigationItem.rightBarButtonItem]; 
相关问题