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