使用图标字体加快您的 iOS 应用开发!
图标字体在网页开发领域非常流行。它们非常出色。通过 Stencils,现在您可以在 iOS 应用的开发中访问图标字体的强大功能和出色之处,并节省大量与设计师交换电子邮件以获取具有0.5点更多向左阴影并更不透明3.141592%的新资源的时间。
通过CocoaPods。
pod 'Stencils'
或者
pod 'Stencils', ~> 'x.x.x'
其中x.x.x
是您想要的版本号。最新稳定的是
三步简单操作
只需将.ttf
添加到项目中。无需更新Info.plist
!而且您甚至可以添加多个图标字体。
Stencils需要了解如何读取字体文件。创建一个配置文件,默认情况下,Stencils会查找Stencils.plist
,如下所示:
font-icons Array
Item 0 Dictionary
font-name String The name of the font where the icon is located
icon-name String The name to use to load the icon
icon-code String The unicode caracter corresponding to the icon
i.e: e001
baseline-adjustement Number (Optional) A correction value to compensate eventual offset from the baseline
scale-adjustement Number (Optional) A correction value to change the scale of the icon. Usually used with "baseline-adjustement"
请查看示例项目,以了解实际的plist
配置文件的外观。
STIconsFactory
和STIconView
加载图标#import <StencilsFactory.h>
STIconsFactory *factory = [[StencilsFactory alloc] init];
STIconView *arrow = [iconFactory iconViewForIconNamed:@'arrow-left' withSide:60.0f];
您可以像这样自定义图标:
arrow.background = [UIColor white];
arrow.color = [UIColor black];
// If no color is set the icon will use the tintColor of it's superview
arrow.shadowColor = [UIColor gray];
arrow.shadowOffset = CGSizeMake(1.0f, 1.0f);
username/feature_name