Slide 1

Slide 1 text

在iOS应⽤用中使⽤用 icon font 钟⼦子豪 @PrideChung [email protected] 13年4月21⽇日星期⽇日

Slide 2

Slide 2 text

icon font是制作成字体⽂文件的图标。以字体的⽅方式来 显⽰示图标,在 Web 开发中相当流⾏行。 13年4月21⽇日星期⽇日

Slide 3

Slide 3 text

e.g 13年4月21⽇日星期⽇日

Slide 4

Slide 4 text

13年4月21⽇日星期⽇日

Slide 5

Slide 5 text

icon font好处都有啥? 13年4月21⽇日星期⽇日

Slide 6

Slide 6 text

⽮矢量字体⽂文件,放⼤大不失真 ⼀一次搞定不同分辨率 100% 500% @2x 13年4月21⽇日星期⽇日

Slide 7

Slide 7 text

通过代码⽅方便地控制图标属性 13年4月21⽇日星期⽇日

Slide 8

Slide 8 text

⽂文件体积 13年4月21⽇日星期⽇日

Slide 9

Slide 9 text

在 Web 开发中使⽤用 icon font 指定字体 指定图标编码 13年4月21⽇日星期⽇日

Slide 10

Slide 10 text

在 iOS 中使⽤用 icon font 添加字体 13年4月21⽇日星期⽇日

Slide 11

Slide 11 text

! 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⽇日星期⽇日

Slide 12

Slide 12 text

! UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 45, 45)]; ! label.font = [UIFont fontWithName:@"FontAwesome" size:45]; ! label.text = @"\uf09b"; 13年4月21⽇日星期⽇日

Slide 13

Slide 13 text

Live Demo 代码已上传到 https://github.com/PrideChung/Demos/tree/ master/IconFontDemo 13年4月21⽇日星期⽇日

Slide 14

Slide 14 text

帮助使⽤用 icon font 的库 13年4月21⽇日星期⽇日

Slide 15

Slide 15 text

Font Awesome http://fortawesome.github.io/Font-Awesome/ 13年4月21⽇日星期⽇日

Slide 16

Slide 16 text

iconic http://somerandomdude.com/work/iconic/ 13年4月21⽇日星期⽇日

Slide 17

Slide 17 text

icon font⼤大搜罗 http://www.qianduan.net/icon-font-large-collecting.html 13年4月21⽇日星期⽇日

Slide 18

Slide 18 text

制作 icon font 给你的设计师看这个: http://ux.etao.com/posts/221 13年4月21⽇日星期⽇日

Slide 19

Slide 19 text

I’m looking for jobs (Not the Steve one) 13年4月21⽇日星期⽇日

Slide 20

Slide 20 text

Thank You 13年4月21⽇日星期⽇日