2013/04/21 在 iOScon 上分享的keynote。
在iOS应⽤用中使⽤用icon font钟⼦子豪 @PrideChung[email protected]13年4月21⽇日星期⽇日
View Slide
icon font是制作成字体⽂文件的图标。以字体的⽅方式来显⽰示图标,在 Web 开发中相当流⾏行。13年4月21⽇日星期⽇日
e.g13年4月21⽇日星期⽇日
13年4月21⽇日星期⽇日
icon font好处都有啥?13年4月21⽇日星期⽇日
⽮矢量字体⽂文件,放⼤大不失真⼀一次搞定不同分辨率100%500%@2x13年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/IconFontDemo13年4月21⽇日星期⽇日
帮助使⽤用 icon font 的库13年4月21⽇日星期⽇日
Font Awesomehttp://fortawesome.github.io/Font-Awesome/13年4月21⽇日星期⽇日
iconichttp://somerandomdude.com/work/iconic/13年4月21⽇日星期⽇日
icon font⼤大搜罗http://www.qianduan.net/icon-font-large-collecting.html13年4月21⽇日星期⽇日
制作 icon font给你的设计师看这个:http://ux.etao.com/posts/22113年4月21⽇日星期⽇日
I’m looking for jobs(Not the Steve one)13年4月21⽇日星期⽇日
Thank You13年4月21⽇日星期⽇日