设置自定义字体和文本颜色
Set custom font along with text color
我已将我的导航控制器 titleTextAttributes 设置为使用自定义字体,为此我使用了以下代码
[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Neon80s" size:21],NSFontAttributeName, nil]];
我想为此添加颜色?如果我将它与自定义字体分开进行,它会高估它,所以我猜测的颜色需要包含在上述方法中吗?
正如我所见,Neon80s
在 iOS 中不可用。但是对于字体大小为 21 和文本颜色为 red
的 Arial
,您可以使用以下代码。
[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Arial" size:21],NSFontAttributeName,[UIColor redColor],NSForegroundColorAttributeName ,nil]];
我已将我的导航控制器 titleTextAttributes 设置为使用自定义字体,为此我使用了以下代码
[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Neon80s" size:21],NSFontAttributeName, nil]];
我想为此添加颜色?如果我将它与自定义字体分开进行,它会高估它,所以我猜测的颜色需要包含在上述方法中吗?
Neon80s
在 iOS 中不可用。但是对于字体大小为 21 和文本颜色为 red
的 Arial
,您可以使用以下代码。
[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Arial" size:21],NSFontAttributeName,[UIColor redColor],NSForegroundColorAttributeName ,nil]];