
이 라이브러리를 제발.
이제 다른 글꼴 아이콘을 포함시키기 위해 다른 라이브러리를 다운로드 할 필요가 없습니다. 이 Swifticons 라이브러리는 다음 글꼴 아이콘 중 하나의 아이콘을 사용하는 데 도움이됩니다.
Swifticons는 객체 라이브러리의 다른 객체를 지원합니다.
Cocoapods는 코코아 프로젝트의 종속성 관리자입니다.
실행하여 최신 버전의 Cocoapods가 있는지 확인하십시오.
$ gem install cocoapods
# (or if the above fails)
$ sudo gem install cocoapods실행을 통해 로컬 사양 리포지토리 업데이트 :
$ pod repo update Podfile 에 다음 줄을 추가하십시오.
target 'YourProject' do
use_frameworks!
pod 'SwiftIcons' , '~> 3.0'
end그런 다음 다음 명령을 실행하십시오
$ pod install원하는 곳에서 가져 와서 라이브러리 사용을 시작할 수 있습니다.
import SwiftIconsCarthage는 코코아 프로젝트의 분산 형 의존 관리자입니다.
최신 버전의 Carthage를 설치하십시오.
이 라인을 Cartfile 에 추가하십시오.
github "ranesr/SwiftIcons" ~> 3.0
또는 master ,
github "ranesr/SwiftIcons" "master"
그런 다음 carthage update --platform ios 실행하고 Carthage의 이러한 지침에 따라 프로젝트에 빌드 프레임 워크를 추가하십시오.
Source 폴더에서 모든 파일을 복사하십시오. 파일 링크.
프로젝트에서 모든 TTF 파일을 가져 오도록 확인하십시오. "Project"> "Target"> "복사 번들 리소스"
여기에서 라이브러리 참조 문서를 확인할 수 있습니다.
각 글꼴 아이콘마다 다른 글꼴 유형이 있습니다.
| 글꼴 아이콘 | 버전 | 글꼴 유형 | 아이콘 |
|---|---|---|---|
| 드리 피콘 | 2.0 | 드리 피콘 | 드리 피콘 |
| 이모티콘 | 이모티콘 | 이모티콘 | |
| fontawesome | 5.1.0 | fontawesome | fontawesome |
| 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 앱을 확인하십시오. 데모 프로젝트에서 객체를 클릭하면 해당 객체의 아이콘 로그에 메소드 설명이 표시됩니다.
앱에서 Swifticon을 사용하고 있으며 여기에 나열되기를 원한다면 여기에서 새로운 문제를 만듭니다.
누가 내 프로젝트를 사용하고 있는지 항상 궁금합니다.
사우 라브 레인
Patrik Vaberer에게 감사의 말씀을 전하며 Font-Oneings-Swift Library에 대한 그의 초기 작업
Swifticons는 MIT 라이센스에 따라 제공됩니다. 자세한 내용은 LICENSE 파일을 참조하십시오.