Pas encore pris en charge. Veuillez utiliser Cocoapods ou Carthage
github " segecey/SwiftIconFont "Cocoapods est un gestionnaire de dépendances pour les projets de cacao.
Vous pouvez l'installer avec la commande suivante:
gem install cocoapods Pour intégrer SwifIConFont dans votre projet Xcode à l'aide de cocoapods, spécifiez-le dans votre Podfile :
use_frameworks!
pod 'SwiftIconFont' Pour exécuter l'exemple de projet, clonez le repo et exécutez d'abord pod install à partir de l'exemple du répertoire.
| Fonte | Préfixe | Feuille de triche |
|---|---|---|
| Font génial 5 | FA5: | Liste |
| Font génial 5 marque | FA5B: | Liste |
| Font génial 5 solide | FA5: | Liste |
| Icônes ion | IO: | Liste |
| Octocons | OC: | Liste |
| Ouvert emblématique | IC: | Liste |
| Icône de matériau | MA: | Liste |
| Thèmer | ti: | Liste |
| Icônes de carte | mi: | Liste |
| Segoe MDL2 | SM: | Liste |
| Fondation 3 | FO: | Liste |
| Icône élégante | EL: | Liste |
| Capitaine | CP: | Veuillez vérifier l'exemple de projet. |
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 "
} <frefix>: <cône>
Dans votre Uilabel, UIbutton ou Uitextfield, définissez un texte contenant un espace réservé partout où vous voulez que l'icône soit. Quelque chose comme ça
OC: Logo-Github
Ensuite, vous pouvez choisir entre 3 façons d'utiliser SwifIConFont.
Importez simplement SwifIConFont et Call Processicons sur n'importe quel Uilabel, UIbutton ou UiteXtfield qui a un espace réservé.
label . parseIcon ( ) La manière paresseuse, définissez simplement votre classe Uilabel, Uitextfield, UIbutton, UitextView, Uibarbuttonitem comme SwifIconLabel, SwifIConTextField, SwifIconButton, SwiftiContextView, SwiftBarbuttonItem, et c'est It, vos icônes seront traitées à l'étranger.
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 çiftçi - [email protected]
josejuanqm
SwifIconFont est disponible sous la licence du MIT. Voir le fichier de licence pour plus d'informations.
git checkout -b my-new-feature )git commit -am 'Add some feature' )git push origin my-new-feature )