Latest 0.3
Homepage https://github.com/lacklock/ZHIconFontKit
License MIT
Platforms ios 8.0
Authors

Language
CocoaPods
Carthage compatible
License

Using icon font in Swift

Requirements

iOS 8.0+

Installation

CocoaPods

To integrate ZHIconFontKit into your Xcode project using CocoaPods, specify it in your Podfile:

  use_frameworks!

  pod ‘ZHIconFontKit’

if you are using swift 2.2:

   pod 'ZHIconFontKit',:git => 'https://github.com/lacklock/ZHIconFontKit.git',:branch => '2.2'

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 : @没故事的卓同学

Latest podspec

{
    "name": "ZHIconFontKit",
    "version": "0.3",
    "summary": "Using icon font in Swift",
    "homepage": "https://github.com/lacklock/ZHIconFontKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "u5353u540cu5b66": "[email protected]"
    },
    "social_media_url": "http://weibo.com/1926303682",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/lacklock/ZHIconFontKit.git",
        "tag": "0.3"
    },
    "source_files": "IconFontKit/*.swift",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This