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.7k
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
ALL CODE BASE ARE BELONG TO STUDY
uzulla
27
6.6k
CSC305 Lecture 09
javiergs
PRO
0
300
スマホから Youtube Shortsを見られないようにする
lemolatoon
27
33k
フロントエンド開発のためのブラウザ組み込みAI入門
masashi
7
3.3k
モテるデスク環境
mozumasu
3
900
Leading Effective Engineering Teams in the AI Era
addyosmani
7
560
contribution to astral-sh/uv
shunsock
0
440
Webサーバーサイド言語としてのRustについて
kouyuume
1
3.8k
デミカツ切り抜きで面倒くさいことはPythonにやらせよう
aokswork3
0
260
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
380
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
390
Goで実践するドメイン駆動開発 AIと歩み始めた新規プロダクト開発の現在地
imkaoru
4
870
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.9k
How GitHub (no longer) Works
holman
315
140k
Music & Morning Musume
bryan
46
6.9k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
Documentation Writing (for coders)
carmenintech
75
5.1k
A Tale of Four Properties
chriscoyier
161
23k
jQuery: Nuts, Bolts and Bling
dougneiner
65
7.9k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Balancing Empowerment & Direction
lara
5
700
Rails Girls Zürich Keynote
gr2m
95
14k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.1k
Transcript
在iOS应⽤用中使⽤用 icon font 钟⼦子豪 @PrideChung
[email protected]
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⽇日星期⽇日