TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Nov 2017 |
SwiftSwift Version | 4.0 |
SPMSupports SPM | ✗ |
Maintained by lacklock.
Using icon font in Swift
iOS 8.0+
Just copy the files which under IconFontKit folder to your project
1.make sure you font has been copy to bundle,check Build Phases:
2.after import ZHIconFontKit
,register icon font:
IconFont.registerIconFontWithName("iconfont")
3.create a enum
rawValue type is Int and conform to UnicodeString
protocol:
enum DXYIconFont: Int,UnicodeString{
case xxx = 59031
case yyy = 59027
}
label.setIconFont(DXYIconFont.xxx, size: 40)
button.setTitleIconFont(DXYIconFont.yyy, size: 50)
imageView.image = UIImage.iconForIconFont(DXYIconFont.safari, size: 100, color: UIColor.purpleColor(), backgroundColor: UIColor.grayColor(), iconInset: UIEdgeInsets(top: 10, left: 0, bottom: 0, right: 0))
If you are using in xib,just the same as using a cutom font.After set font as custom font,then paste icon from FontBook in atturibute pannel
Weibo : @没故事的卓同学