导航项颜色的行为与上一个控制器相同。我该如何修复这个问题?

huangapple go评论73阅读模式
英文:

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
}

huangapple
  • 本文由 发表于 2020年1月3日 19:49:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/59578109.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定