Belum didukung. Silakan gunakan cocoapods atau carthage
github " segecey/SwiftIconFont "Cocoapods adalah manajer ketergantungan untuk proyek kakao.
Anda dapat menginstalnya dengan perintah berikut:
gem install cocoapods Untuk mengintegrasikan swifticonfont ke dalam proyek Xcode Anda menggunakan cocoapods, tentukan di Podfile Anda:
use_frameworks!
pod 'SwiftIconFont' Untuk menjalankan proyek contoh, klon repo, dan menjalankan pod install dari direktori contoh terlebih dahulu.
| Font | Awalan | Lembar Cheat |
|---|---|---|
| Font Awesome 5 | FA5: | Daftar |
| Font Awesome 5 Brand | FA5B: | Daftar |
| Font mengagumkan 5 solid | FA5S: | Daftar |
| Ikon ion | IO: | Daftar |
| Octicons | OC: | Daftar |
| Buka ikon | IC: | Daftar |
| Ikon materi | Ma: | Daftar |
| Temifikasi | TI: | Daftar |
| Ikon peta | MI: | Daftar |
| Segoe mdl2 | SM: | Daftar |
| Foundation 3 | fo: | Daftar |
| Ikon yang elegan | EL: | Daftar |
| Kapten | CP: | Harap periksa contoh proyek. |
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 "
} <drefix>: <icon>
Di UiLabel Anda, UIBUTTON atau UITEXTFIELD, atur teks yang berisi placeholder di mana pun Anda ingin ikon itu. Sesuatu seperti ini
OC: Logo-github
Kemudian Anda dapat memilih antara 3 cara Anda dapat menggunakan Swifticonfont.
Cukup impor swifticonfont dan hubungi Processicons pada uilabel, uibutton atau uitextfield yang memiliki placeholder.
label . parseIcon ( ) Jalan malas, cukup atur kelas UiLabel, UITEXTFIELD, UIBUTTON, UITEXTVIEW, UIBARBUTTONITEM sebagai SwifticonLabel, Swifticontextfield, SwifticonButton, SwifticontextView, SwiftBarbuttonItem, dan itu, ikon Anda akan diproses saat runtime.
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 çİftçİ - [email protected]
Josejuanqm
Swifticonfont tersedia di bawah lisensi MIT. Lihat file lisensi untuk info lebih lanjut.
git checkout -b my-new-feature )git commit -am 'Add some feature' )git push origin my-new-feature )