FontasticIcons 是图标字体的 Objective-C 封装。
只需将 FontasticIcons/Sources/Classes
目录的源文件添加到您的项目中。
#import <FontasticIcons.h>
...
FIIconView *iconView = [[FIIconView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
iconView.backgroundColor = [UIColor clearColor];
iconView.icon = [FIEntypoIcon leafIcon];
iconView.padding = 2;
iconView.iconColor = [UIColor greenColor];
[self.view addSubview:iconView];
#import <FontasticIcons.h>
...
FIIcon *icon = [FIEntypoIcon leafIcon];
UIImage *image = [icon imageWithBounds:CGRectMake(0, 0, 30, 30) color:[UIColor blackColor]];
[self.tabBarItem setImage:image];
#import <FontasticIcons.h>
...
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(0, 0, 60, 40);
FIIcon *icon = [FIEntypoIcon leafIcon];
FIIconLayer *layer = [FIIconLayer new];
layer.icon = icon;
layer.frame = button.bounds;
layer.iconColor = [UIColor greenColor];
[button.layer addSublayer:layer];
源代码在 MIT 许可下分发。
注意,所有字体都有其自己的许可。