Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Using icon font in iOS
Pride Chung
April 21, 2013
Programming
3
5.2k
Using icon font in iOS
2013/04/21 在 iOScon 上分享的keynote。
Pride Chung
April 21, 2013
Tweet
Share
Other Decks in Programming
See All in Programming
あなたの会社の古いシステム、なんとかしませんか?~システム刷新から考えるDX化への道筋とバリエーション~/webinar20220420-systems
grapecity_dev
0
120
microCMS × imgixを活用して品質とレスポンスを両立したポートフォリオサイトを作成した話
takehitogoto
0
390
Microsoft Teams の 会議アプリ開発のはじめかた / How to start Microsoft Teams app development
karamem0
0
1.4k
Testing, how hard can it be? (Droidcon Lisbon 2022)
dpreussler
3
200
About Type Syntax Proposal
quramy
1
890
SRE NEXT 2022: Sensible Incident Management for Software Startups
takanabe
2
230
Reinventing the wheel ... as a service
mariofusco
3
220
C言語でメモリ管理を考えた話
hkawai
0
180
mrubyを1300円のボードで動かそう
yuuu
0
180
Reactでアプリケーションを構築する多様化
sakito
4
3k
From Java 11 to 17 and beyond
josepaumard
0
290
WindowsコンテナDojo : 第1回 Visual StudioでWindowsコンテナアプリ作成
oniak3ibm
PRO
0
320
Featured
See All Featured
Building an army of robots
kneath
299
40k
Build The Right Thing And Hit Your Dates
maggiecrowley
19
1.1k
Unsuck your backbone
ammeep
659
55k
Designing on Purpose - Digital PM Summit 2013
jponch
106
5.6k
The Most Common Mistakes in Cover Letters
jrick
PRO
4
24k
How STYLIGHT went responsive
nonsquared
85
3.9k
WebSockets: Embracing the real-time Web
robhawkes
57
5k
Designing Experiences People Love
moore
130
22k
For a Future-Friendly Web
brad_frost
164
7.4k
Typedesign – Prime Four
hannesfritz
33
1.3k
Visualization
eitanlees
124
11k
YesSQL, Process and Tooling at Scale
rocio
157
12k
Transcript
在iOS应⽤用中使⽤用 icon font 钟⼦子豪 @PrideChung pride.chung@gmail.com 13年4月21⽇日星期⽇日
icon font是制作成字体⽂文件的图标。以字体的⽅方式来 显⽰示图标,在 Web 开发中相当流⾏行。 13年4月21⽇日星期⽇日
e.g 13年4月21⽇日星期⽇日
13年4月21⽇日星期⽇日
icon font好处都有啥? 13年4月21⽇日星期⽇日
⽮矢量字体⽂文件,放⼤大不失真 ⼀一次搞定不同分辨率 100% 500% @2x 13年4月21⽇日星期⽇日
通过代码⽅方便地控制图标属性 13年4月21⽇日星期⽇日
⽂文件体积 13年4月21⽇日星期⽇日
在 Web 开发中使⽤用 icon font 指定字体 指定图标编码 13年4月21⽇日星期⽇日
在 iOS 中使⽤用 icon font 添加字体 13年4月21⽇日星期⽇日
! static dispatch_once_t onceToken; ! dispatch_once(&onceToken, ^{ ! ! NSURL
* url = [[NSBundle mainBundle] URLForResource:@"FontAwesome" withExtension:@"otf"]; ! ! CGDataProviderRef fontDataProvider = CGDataProviderCreateWithURL((__bridge CFURLRef)url); ! ! CGFontRef newFont = CGFontCreateWithDataProvider(fontDataProvider); ! ! CGDataProviderRelease(fontDataProvider); ! ! CFErrorRef error; ! ! CTFontManagerRegisterGraphicsFont(newFont, &error); ! ! CGFontRelease(newFont); ! }); ! ! UIFont *font = [UIFont fontWithName:@"FontAwesome" size:size]; 运⾏行时注册 在项⺫⽬目的Info.plist中注册 或者 13年4月21⽇日星期⽇日
! UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 45, 45)];
! label.font = [UIFont fontWithName:@"FontAwesome" size:45]; ! label.text = @"\uf09b"; 13年4月21⽇日星期⽇日
Live Demo 代码已上传到 https://github.com/PrideChung/Demos/tree/ master/IconFontDemo 13年4月21⽇日星期⽇日
帮助使⽤用 icon font 的库 13年4月21⽇日星期⽇日
Font Awesome http://fortawesome.github.io/Font-Awesome/ 13年4月21⽇日星期⽇日
iconic http://somerandomdude.com/work/iconic/ 13年4月21⽇日星期⽇日
icon font⼤大搜罗 http://www.qianduan.net/icon-font-large-collecting.html 13年4月21⽇日星期⽇日
制作 icon font 给你的设计师看这个: http://ux.etao.com/posts/221 13年4月21⽇日星期⽇日
I’m looking for jobs (Not the Steve one) 13年4月21⽇日星期⽇日
Thank You 13年4月21⽇日星期⽇日