Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/95.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 更改目标c中的视图控制器标题颜色_Ios_User Interface_Uiviewcontroller - Fatal编程技术网

Ios 更改目标c中的视图控制器标题颜色

Ios 更改目标c中的视图控制器标题颜色,ios,user-interface,uiviewcontroller,Ios,User Interface,Uiviewcontroller,我想改变视图控制器标题的颜色,就像这个黑色的一样 尝试此操作,在ViewWillDisplay函数中添加此代码:- 根据您的字体传递字体名称 [self.navigationController.navigationBar setTitleTextAttributes: @{NSForegroundColorAttributeName:[UIColor blackColor], NSFontAttributeName:[UIFont fontWithName:@"Helvetica-regul

我想改变视图控制器标题的颜色,就像这个黑色的一样


尝试此操作,在ViewWillDisplay函数中添加此代码:-

根据您的字体传递字体名称

[self.navigationController.navigationBar setTitleTextAttributes:
 @{NSForegroundColorAttributeName:[UIColor blackColor],
NSFontAttributeName:[UIFont fontWithName:@"Helvetica-regular" size:17]}];

仅为一个视图控制器更改标题颜色:

视图中使用以下代码将出现

[self.navigationController.navigationBar setTitleTextAttributes:
 @{NSForegroundColorAttributeName:[UIColor blackColor]}];

整个应用程序的标题颜色更改:

didfishLaunching

[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor]}];
?