CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

ZHIconFontKit 0.4

ZHIconFontKit 0.4

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Nov 2017
SwiftSwift Version 4.0
SPMSupports SPM

Maintained by lacklock.



ZHIconFontKit

Using icon font in Swift

Requirements

iOS 8.0+

Installation

Manual

Just copy the files which under IconFontKit folder to your project

Thaks

FontBlaster

IconFont

Usage

1.make sure you font has been copy to bundle,check Build Phases: Copy Bundle Resources

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
}

UILabel

label.setIconFont(DXYIconFont.xxx, size: 40)

UIButton

button.setTitleIconFont(DXYIconFont.yyy, size: 50)

UIImage

imageView.image = UIImage.iconForIconFont(DXYIconFont.safari, size: 100, color: UIColor.purpleColor(), backgroundColor: UIColor.grayColor(), iconInset: UIEdgeInsets(top: 10, left: 0, bottom: 0, right: 0))

Xib

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 FontBook

SNS

Weibo : @没故事的卓同学