测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2017年2月 |
由capsule维护。
依赖 | |
FontAwesome | ~> 4.5.0 |
Masonry | ~> 1.0.2 |
将标志性的FontAwesome字体引入iOS。
将以下内容添加到您的Podfile
中
pod 'FontAwesome'
这将自动将辅助文件和字体资源包含到您的应用中。
首先,请确保您已经将FontAwesome.ttf
打包到您的项目中,并且在项目的plist文件中的UIAppFonts
键包含一个名为FontAwesome.ttf
的String项。
然后将NSString+FontAwesome
类别添加到项目中。
UILabel *label = [...]
label.font = [UIFont fontWithName:kFontAwesomeFamilyName size:20];
您现在可以使用enum的所有不同图标字符
label.text = [NSString fontAwesomeIconStringForEnum:FAGithub];
或者您可以通过这里列出的类标识符引用它们 http://fortawesome.github.com/Font-Awesome/#all-icons
label.text = [NSString fontAwesomeIconStringForIconIdentifier:@"fa-github"];
就是这样!更多信息请查看小演示项目!
FAImageView现在已扩展,并包含一个名为defaultView
的新属性,当将图像设置为nil时显示。
可以使用其中一个font-awesome图标作为图像视图的默认占位符。
FAImageView *imageView = [[FAImageView alloc] initWithFrame:CGRectMake(0.f, 0.f, 100.f, 100.f)];
imageView.image = nil;
[imageView setDefaultIconIdentifier:@"fa-github"];
(从https://github.com/alexdrone/ios-fontawesome分叉,作为CocoaPod可供使用)
从Font Awesome 3.0开始不再需要归属,但仍然非常感谢:"Font Awesome by Dave Gandy - http://fontawesome.io"。