oreText note: Client requested name ".SFUI-Regular"xxxxxx

391 阅读1分钟
  • 报错

**CoreText note: Client requested name ".SFUI-Regular", it will get TimesNewRomanPSMT rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[UIFont systemFontOfSize:].**

  • 解决方法:

在使用这个类似的方法时CTFontRef textFont = CTFontCreateWithName(( CFStringRef)([font fontName]), [font pointSize], NULL);[font fontName]进行如下处理就好了。

   NSString *fontName =  [font fontName];
if ([fontName isEqualToString:@".SFUI-Regular"]) {
        fontName = @"TimesNewRomanPSMT";
    }