加载ttf字体

+ (UIFont *)flatFontOfSize:(CGFloat)size {

    static dispatch_once_t onceToken;

    dispatch_once(&onceToken, ^{

        NSURL * url = [[NSBundle mainBundle] URLForResource:@"Lato-Regular" withExtension:@"ttf"];

        CFErrorRef error;

        CTFontManagerRegisterFontsForURL((__bridge CFURLRef)url, kCTFontManagerScopeNone, &error);

        error = nil;

    });

    return [UIFont fontWithName:@"Lato-Regular" size:size];

}

 

你可能感兴趣的:(加载)