ViewController title color will change change color when back button clicked

时间:2021-09-26 09:33:47

I have a Home viewController, and it's linked to another viewController via Segue animation (so I have also linked the home ViewController to a NavigationContoller). In the Home Viewcontroller, I have changed the title text to orange, but when I click the button that triggers the segue and then come back to the Home ViewController, the title changed color.

我有一个Home viewController,它通过Segue动画链接到另一个viewController(所以我也将主ViewController链接到NavigationContoller)。在Home Viewcontroller中,我将标题文本更改为橙色,但是当我单击触发segue的按钮然后返回到Home ViewController时,标题会改变颜色。

Home ViewController in its normal state - Back button clicked in the next view and back to Home ViewController

Home ViewController处于正常状态 - 后退按钮在下一个视图中单击并返回到Home ViewController

1 个解决方案

#1


1  

Since you did not show the code, I don't know what is wrong with it. But here's how I always do it and it works:

由于你没有显示代码,我不知道它有什么问题。但这是我一直这样做的方式,它的工作原理如下:

Go to your storyboard file and select "Navigation Bar" under "Navigation Controller Scene" in the hierachy thingy:

转到故事板文件,然后在层次结构的“导航控制器场景”下选择“导航栏”:

ViewController title color will change change color when back button clicked

Go to the Property Inspector on the right and find this item:

转到右侧的Property Inspector,找到这个项目:

ViewController title color will change change color when back button clicked

Set it to the desired color!

将其设置为所需的颜色!

#1


1  

Since you did not show the code, I don't know what is wrong with it. But here's how I always do it and it works:

由于你没有显示代码,我不知道它有什么问题。但这是我一直这样做的方式,它的工作原理如下:

Go to your storyboard file and select "Navigation Bar" under "Navigation Controller Scene" in the hierachy thingy:

转到故事板文件,然后在层次结构的“导航控制器场景”下选择“导航栏”:

ViewController title color will change change color when back button clicked

Go to the Property Inspector on the right and find this item:

转到右侧的Property Inspector,找到这个项目:

ViewController title color will change change color when back button clicked

Set it to the desired color!

将其设置为所需的颜色!