英文:
Navigation item color behave like previous controller. How can I fix this?
问题
我有一个关于导航项颜色行为的快速问题。例如,我的**“A”控制器的导航项颜色是红色。而“B”控制器的导航项颜色是默认的(蓝色)。当我从主控制器推到“A”控制器,然后转到“B”控制器时,这个“B”**控制器的导航项颜色显示为红色。但它应该是默认颜色!!
我的意思是第二个控制器的行为应该像前一个控制器一样。你有关于这个的任何想法吗?
英文:
I have a quick question about navigation item color behavior. For example my "A" controller's navigation item color is red. And "B" controller's navigation item color is default (blue). When I push from main controller to "A" controller and then go to "B" controller, this "B" controller's navigation item color displaying red. But it should be default color!!
I mean second controller behave like previous controller. Have you any idea about that ?
答案1
得分: 1
你能尝试将这段代码放入您的 B 控制器中吗?
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.navigationBar.tintColor = .systemBlue
}
英文:
Can you try set this code in your B Controller?
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.navigationBar.tintColor = .systemBlue
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论