Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Using icon font in iOS
Search
Pride Chung
April 21, 2013
Programming
3
5.6k
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
DevDay2025-OracleDatabase-kernel-addressing-history
oracle4engineer
PRO
7
1.7k
Zennの運営完全に理解した #完全に理解したTalk
wadayusuke
1
160
Step up the performance game with Spring Boot and Project Leyden
mhalbritter
0
140
ソフトウェア品質特性、意識してますか?AIの真の力を引き出す活用事例 / ai-and-software-quality
minodriven
19
6.8k
💎 My RubyKaigi Effect in 2025: Top Ruby Companies 🌐
yasulab
PRO
1
130
Rails産でないDBを Railsに引っ越すHACK - Omotesando.rb #110
lnit
1
150
ワンバイナリWebサービスのススメ
mackee
10
7.6k
がんばりすぎないコーディングルール運用術
tsukakei
1
200
Blueskyのプラグインを作ってみた
hakkadaikon
1
360
「兵法」から見る質とスピード
ickx
0
230
バランスを見極めよう!実装の意味を明示するための型定義 TSKaigi 2025 Day2 (5/24)
whatasoda
2
800
當開發遇上包裝:AI 如何讓產品從想法變成商品
clonn
0
2.8k
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
76
5.8k
We Have a Design System, Now What?
morganepeng
52
7.6k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
25
2.8k
A better future with KSS
kneath
239
17k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
How STYLIGHT went responsive
nonsquared
100
5.6k
Art, The Web, and Tiny UX
lynnandtonic
298
21k
Balancing Empowerment & Direction
lara
1
100
How to train your dragon (web standard)
notwaldorf
92
6.1k
Embracing the Ebb and Flow
colly
85
4.7k
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⽇日星期⽇日