2015-02-24 48 views
0

我已经把我的导航控制器titleTextAttributes使用自定义的字体,我用下面的代码为这个自定义设置字体以及文本颜色

[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Neon80s" size:21],NSFontAttributeName, nil]]; 

我想包括这一个颜色吗?如果我单独对自定义字体做了过分修饰,所以我猜测的颜色需要包含在上述方法中?

回答

0

Neon80s在iOS中不可用,正如我所见。但对于Arial,字体大小为21,文字颜色为red,则可以使用下面的代码。

[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Arial" size:21],NSFontAttributeName,[UIColor redColor],NSForegroundColorAttributeName ,nil]]; 
+0

对不起氖是我添加的自定义字体。感谢这正是我所追求的 – burrGGG 2015-02-24 11:34:49