Font Awesome Swift
1.0.0

跟著我:@Vaberer
我喜歡★。不要忘記★這個超級方便的圖書館。
UISegmentedControl和UITabbarItem和UISlider和UIStepper和UITextField支持!字體真棒iOS庫。不再是圖像圖標。使用字體Awesome Swift庫非常易於使用。查看顯示所有圖標及其名稱的演示應用程序,或者只是訪問Fontawesome。

Cocoapods是可可項目的依賴性經理。
Cocoapods 0.36增加了Swift和Embedded Frameworks的支持。您可以使用以下命令安裝它:
$ gem install cocoapods要使用Cocoapods將“ Awesome Swift”集成到您的Xcode項目中,請在您的Podfile中指定它:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios , '8.0'
use_frameworks!
pod 'Font-Awesome-Swift' , '~> 1.7.2'然後,運行以下命令:
$ pod install不要忘記將要使用此庫的Swift文件導入:
import Font_Awesome_Swift查看分支swift-2.2 , swift-2.3或swift-3
FAIcon.swift和FontAwesome.ttf文件中的項目FontAwesome.ttf ,“ project”>“目標”>“複製捆綁資源” 超級簡單的方法如何添加圖標。

有關堆疊的圖像,請參閱堆疊的圖標
UIImage . init ( icon : . FATwitter , size : CGSize ( width : 35 , height : 35 ) )
// Change colors
UIImage . init ( icon : . FATwitter , size : CGSize ( width : 35 , height : 35 ) , textColor : . red , backgroundColor : . black )
// Stacked Images With Bigger Background
UIImage . init ( bgIcon : . FASquareO , bgTextColor : . white , topIcon : . FATwitter , topTextColor : . white , bgLarge : true )
UIImage . init ( bgIcon : . FACircle , bgTextColor : . black , topIcon : . FAFlag , topTextColor : . white , bgLarge : true )
// Stacked Images With Smaller Background
UIImage . init ( bgIcon : . FACamera , bgTextColor : . black , topIcon : . FABan , topTextColor : . red , bgLarge : false )
// Stacked Images With Bigger Background and Custom Size
UIImage . init ( bgIcon : . FASquare , bgTextColor : . black , topIcon : . FATerminal , topTextColor : . white , bgLarge : true , size : CGSize ( width : 50 , height : 50 ) ) imageView . setFAIconWithName ( icon : . FATwitter , textColor : . blue , backgroundColor : . gray )
imageView . setFAIconWithName ( icon : . FATwitter , textColor : . blue )
labelName . FAIcon = . FAGithub
labelName . setFAIcon ( icon : . FAGithub , iconSize : 35 )
labelName . setFAText ( prefixText : " follow me on " , icon : . FATwitter , postfixText : " . Thanks! " , size : 25 )
// Bigger icon:
labelName . setFAText ( prefixText : " follow me on " , icon : . FATwitter , postfixText : " . Thanks! " , size : 25 , iconSize : 30 )
labelName . setFAColor ( . red )
buttonName . setFAIcon ( icon : . FAGithub , forState : . normal )
// Set icon size
buttonName . setFAIcon ( icon : . FAGithub , iconSize : 35 , forState : . normal )
buttonName . setFAText ( prefixText : " follow me on " , icon : . FATwitter , postfixText : " . Thanks! " , size : 25 , forState : . normal )
// Bigger icon
buttonName . setFAText ( prefixText : " follow me on " , icon : . FATwitter , postfixText : " . Thanks! " , size : 25 , forState : . normal , iconSize : 30 )
// Change color:
buttonName . setFATitleColor ( color : . red , forState : . normal ) )
// Standard font size
barName . FAIcon = . FAGithub
// Custom font size
barName . setFAIcon ( icon : . FAGithub , iconSize : 35 )
barName . setFAText ( prefixText : " follow me on " , icon : . FATwitter , postfixText : " . Thanks! " , size : 25 )
barName . tintColor = . red // Right View Icon
textfield . setRightViewFAIcon ( icon : . FASearch , rightViewMode : . always , textColor : . red , backgroundColor : . clear , size : nil )
// Left View Icon
textfield . setLeftViewFAIcon ( icon : . FAPlus , leftViewMode : . always , textColor : . red , backgroundColor : . clear , size : nil ) segmentedControl . setFAIcon ( icon : . FATwitter , forSegmentAtIndex : 0 )
stepper . setFABackgroundImage ( icon : . FAGithub , forState : . normal )
stepper . setFAIncrementImage ( icon : . FABellO , forState : . normal )
stepper . setFADecrementImage ( icon : . FABellSlashO , forState : . normal )
tabBarController ? . tabBar . items ? . first ? . setFAIcon ( . FATwitter )
// Options to change selected and unselected color
tabBarItem . setFAIcon ( icon : . FATwitter , size : nil , textColor : . red , backgroundColor : . black , selectedTextColor : . yellow , selectedBackgroundColor : . white )
// Options to change selected and unselected color with specific size
tabBarItem . setFAIcon ( icon : . FATwitter , size : CGSize ( width : 35 , height : 35 ) , textColor : . red , backgroundColor : . black , selectedTextColor : . yellow , selectedBackgroundColor : . white )
// Change minimum or maximum value image
slider . setFAMinimumValueImage ( icon : . FABellSlashO )
slider . setFAMaximumValueImage ( icon : . FABellO )
// change minimum or maximum value image with a specific size
slider . setFAMinimumValueImage ( icon : . FABellSlashO , customSize : CGSize ( width : 35 , height : 35 ) )
slider . setFAMaximumValueImage ( icon : . FABellO , customSize : CGSize ( width : 35 , height : 35 ) )
// Change navigation title
FATitle = . FATwitter
patrik vaberer,[email protected]
字體Awesome Swift可在MIT許可下獲得。有關更多信息,請參見許可證文件。