Noch nicht unterstützt. Bitte verwenden Sie Cocoapods oder Karthago
github " segecey/SwiftIconFont "Cocoapods ist ein Abhängigkeitsmanager für Kakaoprojekte.
Sie können es mit dem folgenden Befehl installieren:
gem install cocoapods Um Swifticonfont mit Cocoapods in Ihr Xcode -Projekt zu integrieren, geben Sie diese in Ihrer Podfile an:
use_frameworks!
pod 'SwiftIconFont' Um das Beispielprojekt auszuführen, klonen Sie das Repo und führen Sie zuerst pod install aus dem Beispielverzeichnis aus.
| Schriftart | Präfix | Cheat Sheet |
|---|---|---|
| Schriftart großartig 5 | FA5: | Liste |
| Schriftart Awesome 5 Marke | FA5B: | Liste |
| Schriftart fantastisch 5 Solid | FA5S: | Liste |
| Ionikonen | io: | Liste |
| Okticons | OC: | Liste |
| Offen Ikone | IC: | Liste |
| Materialikone | MA: | Liste |
| Thematisieren | ti: | Liste |
| Kartensymbole | mi: | Liste |
| Segoe Mdl2 | SM: | Liste |
| Foundation 3 | FO: | Liste |
| Elegante Ikone | EL: | Liste |
| Kapitän | CP: | Bitte überprüfen Sie das Beispielprojekt. |
public enum Fonts : String {
case fontAwesome5 = " FontAwesome5Free-Regular "
case fontAwesome5Brand = " FontAwesome5Brands-Regular "
case fontAwesome5Solid = " FontAwesome5Free-Solid "
case iconic = " open-iconic "
case ionicon = " Ionicons "
case octicon = " octicons "
case themify = " themify "
case mapIcon = " map-icons "
case materialIcon = " MaterialIcons-Regular "
case segoeMDL2 = " Segoe mdl2 assets "
case foundation = " fontcustom "
case elegantIcon = " ElegantIcons "
case captain = " captainicon "
} <prefix>: <kone>
Legen Sie in Ihrem Uilabel, Uibutton oder Uitextfield einen Text ein, der einen Platzhalter enthält, wo das Symbol sein soll. Etwas so
OC: Logo-Github
Dann können Sie zwischen 3 Möglichkeiten wählen, wie Sie Swifticonfont verwenden können.
Im Lauf
label . parseIcon ( ) Der faule Weg, einfach Ihr Uilabel, Uitextfield, Uibutton, UitextView, UibarbuttonItem -Klasse als SwifticonLabel, Swifticontextfield, SwifticonButton, SwifticontextView, SwiftbarbuttonItem, und das, die Ihre Icons verarbeitet werden, werden bei Laufzeiten verarbeitet.
import SwiftIconFont
label . font = UIFont . icon ( from : . fontAwesome5 , ofSize : 50.0 )
label . text = String . fontAwesome5Icon ( code : " twitter " ) import SwiftIconFont
twitterBarButton . icon ( from : . fontAwesome5 , code : " twitter " , ofSize : 20 ) import SwiftIconFont
twitterTabBarButton . icon ( from : . fontAwesome5 , code : " twitter " , imageSize : CGSizeMake ( 20 , 20 ) , ofSize : 20 ) import SwiftIconFont
let githubLogo = UIImage ( from : . octicon , code : " logo-github " , textColor : . black , backgroundColor : . clear , size : CGSize ( width : 150 , height : 50 ) ) import SwiftIconFont
let githubLogoImageView : UIImageView = UIImageView ( frame : CGRect ( x : 120 , y : self . view . frame . size . height - 130 , width : 150 , height : 50 ) )
githubLogoImageView . setIcon ( from : . octicon , code : " logo-github " , textColor : . black , backgroundColor : . clear , size : nil ) Sedat Çiesen
Josejuanqm
Swifticonfont ist im Rahmen der MIT -Lizenz erhältlich. Weitere Informationen finden Sie in der Lizenzdatei.
git checkout -b my-new-feature ).git commit -am 'Add some feature' )git push origin my-new-feature )