Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.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 是否可以自定义IB上导航栏中提示字符串的字体?_Ios_Swift_Storyboard_Uistoryboard - Fatal编程技术网

Ios 是否可以自定义IB上导航栏中提示字符串的字体?

Ios 是否可以自定义IB上导航栏中提示字符串的字体?,ios,swift,storyboard,uistoryboard,Ios,Swift,Storyboard,Uistoryboard,是否可以自定义提示字符串 我已将navigationBarItem连接到我的ViewController,并通过IB添加了一个字符串作为“提示”。提示类后没有允许我更改字符串内容的属性,即颜色,等等。我想知道是否有人知道这个问题的其他解决方法?可以自定义提示外观,但有一个很大的限制,提示和标题的样式将始终相同 假设您位于带有导航栏的导航控制器中显示的UIViewController,则可以执行以下操作: guard let font = UIFont(name: "Helvetica", siz

是否可以自定义提示字符串


我已将navigationBarItem连接到我的ViewController,并通过IB添加了一个字符串作为“提示”。提示类后没有允许我更改字符串内容的属性,即颜色,等等。我想知道是否有人知道这个问题的其他解决方法?

可以自定义提示外观,但有一个很大的限制,提示和标题的样式将始终相同

假设您位于带有导航栏的导航控制器中显示的
UIViewController
,则可以执行以下操作:

guard let font = UIFont(name: "Helvetica", size: 17) else {
   return
}

let navigationBar = navigationController?.navigationBar
navigationBar?.titleTextAttributes = [NSFontAttributeName: font,
                                                            NSForegroundColorAttributeName: UIColor.blue]

您也可以使用
UINavigationBar.appearance()
方法在应用程序中的所有导航栏提示上进行此配置。

它表示不能在类型UINavigationBar上使用titleTextAttributes抱歉,这是基于
appearance()
代理的代码。我编辑我的帖子是为了让它更清晰。这对我来说不起作用,promp的颜色和字体没有改变。死胡同