在UIBarButtonItem上的ios-fontawesome [英] ios-fontawesome on UIBarButtonItem
本文介绍了在UIBarButtonItem上的ios-fontawesome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 iOS FontAwesome 在条形按钮上设置图标,像这样:
I'm trying to use iOS FontAwesome to set an icon on a bar button, like this:
[self.barButton setTitle:[NSString fontAwesomeIconStringForEnum:FACamera]];
以及:
[self.barButton setTitle:[NSString fontAwesomeIconStringForIconIdentifier:@"fa-camera"]];
无论我使用什么标识符,结果都是相同的:
No matter what identifier I use the result is the same:
可能出现什么问题?
推荐答案
万一其他人想知道:
[self.barButton setTitleTextAttributes:@{
NSFontAttributeName: [UIFont fontWithName:@"FontAwesome" size:24.0],
NSForegroundColorAttributeName: self.view.tintColor
} forState:UIControlStateNormal];
[self.barButton setTitle:[NSString fontAwesomeIconStringForIconIdentifier:@"fa-camera"]];
这篇关于在UIBarButtonItem上的ios-fontawesome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文