
กรุณา★ห้องสมุดนี้
ตอนนี้คุณไม่จำเป็นต้องดาวน์โหลดไลบรารีที่แตกต่างกันเพื่อรวมไอคอนแบบอักษรที่แตกต่างกัน ห้องสมุด Swifticons นี้ช่วยให้คุณใช้ไอคอนจากไอคอนตัวอักษรใด ๆ ต่อไปนี้
Swifticons รองรับวัตถุที่แตกต่างจากไลบรารีวัตถุ
Cocoapods เป็นผู้จัดการการพึ่งพาสำหรับโครงการโกโก้
ตรวจสอบให้แน่ใจว่าคุณมี cocoapods เวอร์ชันล่าสุดโดยใช้งาน:
$ gem install cocoapods
# (or if the above fails)
$ sudo gem install cocoapodsอัปเดตข้อมูลจำเพาะในพื้นที่ของคุณ repo โดยการรัน:
$ pod repo update เพิ่มบรรทัดต่อไปนี้ใน Podfile ของคุณ:
target 'YourProject' do
use_frameworks!
pod 'SwiftIcons' , '~> 3.0'
endจากนั้นเรียกใช้คำสั่งต่อไปนี้
$ pod installคุณสามารถเริ่มใช้ห้องสมุดได้โดยนำเข้าทุกที่ที่คุณต้องการ
import SwiftIconsคาร์เธจเป็นผู้จัดการการพึ่งพากระจายอำนาจสำหรับโครงการโกโก้
ติดตั้ง Carthage เวอร์ชันล่าสุด
เพิ่มบรรทัดนี้ใน Cartfile ของคุณ:
github "ranesr/SwiftIcons" ~> 3.0
หรือสำหรับ master
github "ranesr/SwiftIcons" "master"
จากนั้นเรียกใช้ carthage update --platform ios และเพิ่มเฟรมเวิร์กที่สร้างขึ้นในโครงการของคุณโดยทำตามคำแนะนำเหล่านี้จาก Carthage
คัดลอกไฟล์ทั้งหมดจากโฟลเดอร์ Source ลิงก์ไปยังไฟล์
ตรวจสอบเพื่อนำเข้าไฟล์ TTF ทั้งหมดในโครงการ "Project"> "Target"> "คัดลอกแหล่งข้อมูล Bundle"
คุณสามารถตรวจสอบเอกสารอ้างอิงห้องสมุดได้ที่นี่
มีแบบอักษรที่แตกต่างกันสำหรับไอคอนตัวอักษรแต่ละตัว
| ไอคอนแบบอักษร | รุ่น | ประเภทตัวอักษร | ไอคอน |
|---|---|---|---|
| หยดน้ำ | 2.0 | หยดน้ำ | หยดน้ำ |
| อีโมจิ | อีโมจิ | อีโมจิ | |
| ฟอนอตอสมมาก | 5.1.0 | ฟอนอตอสมมาก | ฟอนอตอสมมาก |
| icofont | 1.0.0 เบต้า | icofont | icofont |
| ไอออนนิกอน | 2.0.1 | ไอออนนิกอน | ไอออนนิกอน |
| เชิงเส้น | 1.0.0 | เชิงเส้น | เชิงเส้น |
| แผนที่-ไอคอน | 3.0.2 | Mapicons | Mapicons |
| ไอคอนวัสดุ | 2.2.0 | Googlematerialdesign | Googlematerialdesign |
| เปิดสัญลักษณ์ | 1.1.1 | เกี่ยวกับการเปิดกว้าง | เกี่ยวกับการเปิดกว้าง |
| ไอคอนหน้ารัฐ | สถานะ | สถานะ | |
| ไอคอนสภาพอากาศ | 2.0.10 | สภาพอากาศ | สภาพอากาศ |
| เครื่องราง | 2.0.7 | เครื่องราง | เครื่องราง |
เมื่อตั้งค่าไอคอนกับวัตถุใด ๆ คุณต้องพูดถึงตัวอักษรประเภทใดแล้วเลือกไอคอนที่คุณต้องการตั้งค่าจากไอคอนแบบอักษรนั้น
import SwiftIcons
UIImage . init ( icon : . emoji ( . airplane ) , size : CGSize ( width : 35 , height : 35 ) )
// Icon with colors
UIImage . init ( icon : . emoji ( . airplane ) , size : CGSize ( width : 35 , height : 35 ) , textColor : . red )
UIImage . init ( icon : . emoji ( . airplane ) , size : CGSize ( width : 35 , height : 35 ) , textColor : . white , backgroundColor : . red )
// Stacked icons with bigger background
UIImage . init ( bgIcon : . fontAwesomeRegular ( . circle ) , topIcon : . fontAwesomeRegular ( . square ) )
// Stacked icons with smaller background
UIImage . init ( bgIcon : . fontAwesomeSolid ( . camera ) , topIcon : . fontAwesomeSolid ( . ban ) , topTextColor : . red , bgLarge : false )
// Stacked icons with custom size
UIImage . init ( bgIcon : . fontAwesomeSolid ( . camera ) , topIcon : . fontAwesomeSolid ( . ban ) , topTextColor : . red , bgLarge : false , size : CGSize ( width : 50 , height : 50 ) )import SwiftIcons
// Setting icon to image view
imageView . setIcon ( icon : . weather ( . rainMix ) )
// Icon with colors
imageView . setIcon ( icon : . mapicons ( . amusementPark ) , textColor : . white , backgroundColor : . blue , size : nil )import SwiftIcons
// Setting icon to label
label . setIcon ( icon : . ionicons ( . paintbrush ) , iconSize : 70 )
// Icon with colors
label . setIcon ( icon : . googleMaterialDesign ( . rowing ) , iconSize : 70 , color : . white , bgColor : textColor )
// Icon with text around it
label . setIcon ( prefixText : " Bus " , icon : . linearIcons ( . bus ) , postfixText : " icon " , size : 20 )
// Icon with color & colored text around it
label . setIcon ( prefixText : " Medal " , prefixTextColor : . red , icon : . ionicons ( . ribbonA ) , iconColor : . red , postfixText : " " , postfixTextColor : . red , size : nil , iconSize : 40 )
// Icon with text with different fonts around it
label . setIcon ( prefixText : " Font " , prefixTextFont : font1! , icon : . fontAwesomeSolid ( . font ) , postfixText : " icon " , postfixTextFont : font2! )
// Icon with text with different fonts & colors around it
label . setIcon ( prefixText : " Bike " , prefixTextFont : font1! , prefixTextColor : . red , icon : . mapicons ( . bicycling ) , iconColor : textColor , postfixText : " icon " , postfixTextFont : font2! , postfixTextColor : . blue , iconSize : 30 )import SwiftIcons
// Setting icon to button
button . setIcon ( icon : . linearIcons ( . phone ) , forState : . normal )
// Icon with size and color
button . setIcon ( icon : . openIconic ( . clipboard ) , iconSize : 70 , color : . blue , forState : . normal )
// Icon with text around it
button . setIcon ( prefixText : " Please " , icon : . googleMaterialDesign ( . print ) , postfixText : " print " , forState : . normal )
// Icon with color & colored text around it
button . setIcon ( prefixText : " Lock " , prefixTextColor : . red , icon : . googleMaterialDesign ( . lock ) , iconColor : . yellow , postfixText : " icon " , postfixTextColor : . blue , forState : . normal , textSize : 15 , iconSize : 20 )
// Icon with text with different fonts around it
button . setIcon ( prefixText : " Happy " , prefixTextFont : font1! , icon : . ionicons ( . happy ) , postfixText : " face " , postfixTextFont : font2! , forState : . normal )
// Icon with text with different fonts & colors around it
button . setIcon ( prefixText : " Pulse " , prefixTextFont : font1! , prefixTextColor : . darkGray , icon : . openIconic ( . pulse ) , iconColor : . red , postfixText : " icon " , postfixTextFont : font2! , postfixTextColor : . purple , forState : . normal , iconSize : 40 )
// Icon with title below icon
button . setIcon ( icon : . emoji ( . ferrisWheel ) , title : " Ferris Wheel " , color : . red , forState : . normal )
// Icon with title below icon with different color & custom font
button . setIcon ( icon : . weather ( . rainMix ) , iconColor : . yellow , title : " RAIN MIX " , titleColor : . red , font : font! , backgroundColor : . clear , borderSize : 1 , borderColor : . green , forState : . normal )import SwiftIcons
// Setting icon at particular index
segmentedControl . setIcon ( icon : . linearIcons ( . thumbsUp ) , forSegmentAtIndex : 0 )
segmentedControl . setIcon ( icon : . linearIcons ( . thumbsDown ) , forSegmentAtIndex : 1 )
// Icons with sizes & colors
segmentedControl . setIcon ( icon : . fontAwesomeSolid ( . male ) , color : . red , iconSize : 50 , forSegmentAtIndex : 0 )
segmentedControl . setIcon ( icon : . fontAwesomeSolid ( . female ) , color : . purple , iconSize : 50 , forSegmentAtIndex : 1 )import SwiftIcons
// Setting icon to tab bar item
tabBar . items ? [ 0 ] . setIcon ( icon : . fontAwesomeSolid ( . font ) , size : nil , textColor : . lightGray )
// Stacked icons for tab bar item
tabBar . items ? [ 1 ] . setIcon ( bgIcon : . fontAwesomeRegular ( . circle ) , bgTextColor : . lightGray , topIcon : . fontAwesomeSolid ( . square ) , topTextColor : . lightGray , bgLarge : true , size : nil )import SwiftIcons
// Change minimum & maximum value icons
slider . setMaximumValueIcon ( icon : . emoji ( . digitNine ) )
slider . setMinimumValueIcon ( icon : . emoji ( . digitZero ) )
// Change minimum & maximum value icons with colors
slider . setMaximumValueIcon ( icon : . linearIcons ( . pointerUp ) , customSize : nil , textColor : . red , backgroundColor : . clear )
slider . setMinimumValueIcon ( icon : . linearIcons ( . pointerDown ) , customSize : nil , textColor : . blue , backgroundColor : . clear )import SwiftIcons
// Setting icon to bar button item
barButtonItem . setIcon ( icon : . ionicons ( . iosFootball ) , iconSize : 30 )
// Icon with colors
barButtonItem . setIcon ( icon : . ionicons ( . iosFootball ) , iconSize : 30 , color : textColor )
// Icon with custom cgRect
barButtonItem . setIcon ( icon : . ionicons ( . iosFootball ) , iconSize : 30 , color : textColor , cgRect : CGRect ( x : 0 , y : 0 , width : 30 , height : 30 ) , target : self , action : #selector ( barButtonItem ( sender : ) ) )
// Icon with text around it
barButtonItem . setIcon ( prefixText : " Please " , icon : . ionicons ( . iosDownload ) , postfixText : " download " , cgRect : CGRect ( x : 0 , y : 0 , width : 30 , height : 30 ) , size : 23 , target : self , action : #selector ( barButtonItem ( sender : ) ) )
// Icon with color & colored text around it
barButtonItem . setIcon ( prefixText : " Blue " , prefixTextColor : . red , icon : . ionicons ( . iosFootball ) , iconColor : . blue , postfixText : " football " , postfixTextColor : . green , cgRect : CGRect ( x : 0 , y : 0 , width : 30 , height : 30 ) , size : 20 , iconSize : 30 , target : self , action : #selector ( barButtonItem ( sender : ) ) )
// Icon with text with different fonts around it
barButtonItem . setIcon ( prefixText : " Digit " , prefixTextFont : font1! , icon : . emoji ( . digitOne ) , postfixText : " One " , postfixTextFont : font2! , cgRect : CGRect ( x : 0 , y : 0 , width : 30 , height : 30 ) , target : self , action : #selector ( barButtonItem ( sender : ) ) )
// Icon with text with different fonts & colors around it
barButtonItem . setIcon ( prefixText : " " , prefixTextFont : font1! , prefixTextColor : . red , icon : . ionicons ( . iosFootball ) , iconColor : . blue , postfixText : " football " , postfixTextFont : font2! , postfixTextColor : . green , cgRect : CGRect ( x : 0 , y : 0 , width : 30 , height : 30 ) , iconSize : 24 , target : self , action : #selector ( barButtonItem ( sender : ) ) )import SwiftIcons
// Setting icon to the title
self . setTitleIcon ( icon : . emoji ( . animalHorse ) , iconSize : 30 , color : . red )import SwiftIcons
// Setting left view icon
textfield . setLeftViewIcon ( icon : . fontAwesomeSolid ( . search ) )
// Left view icon with colors & leftViewMode
textfield . setLeftViewIcon ( icon : . state ( . TX ) , leftViewMode : . always , textColor : . blue , backgroundColor : . clear , size : nil )
textfield . setLeftViewIcon ( icon : . googleMaterialDesign ( . plusOne ) , leftViewMode : . unlessEditing , textColor : . green , backgroundColor : . clear , size : nil )
// Setting right view icon
textfield . setRightViewIcon ( icon : . openIconic ( . questionMark ) )
// Right view icon with colors & rightViewMode
textfield . setRightViewIcon ( icon : . weather ( . rainMix ) , rightViewMode : . always , textColor : . red , backgroundColor : . clear , size : nil )import SwiftIcons
// Setting icons
stepper . setDecrementIcon ( icon : . ionicons ( . iosPause ) , forState : . normal )
stepper . setIncrementIcon ( icon : . ionicons ( . iosPlay ) , forState : . normal ) โปรดตรวจสอบแอป Swifticons ในโครงการสาธิตหากคุณคลิกที่วัตถุใด ๆ คุณจะเห็นคำอธิบายวิธีการในบันทึกสำหรับไอคอนของวัตถุนั้น
หากคุณใช้ Swifticons ในแอพของคุณและต้องการแสดงรายการที่นี่เพียงสร้างปัญหาใหม่ที่นี่
ฉันมักจะสงสัยว่าใครใช้โครงการของฉัน?
Saurabh Rane
ขอขอบคุณเป็นพิเศษกับ Patrik Vaberer และงานเริ่มต้นของเขาในห้องสมุด Font-Wesome-Swift Library
Swifticons มีให้บริการภายใต้ใบอนุญาต MIT ดูไฟล์ LICENSE สำหรับข้อมูลเพิ่มเติม