美文网首页IOS
UIFont fontWithName中size不生效的原因

UIFont fontWithName中size不生效的原因

作者: 偷的浮生整日闲 | 来源:发表于2019-07-25 14:04 被阅读0次

    问题

    在用蓝湖的时候,需要设置Label的字体,蓝湖上生成了字体类型,于是拷贝,敲代码:

    label.font = [UIFont fontWithName:@"NotoSansHans-Regular" size:13];

    image.png
    发现字体大小并不生效。

    分析

    IOS可能并不存在这种字体,所以连后面的size一起不生效,编译器也不会给你任何错误提示。

    解决方案

    换成ios能识别的字体,坑爹的美工啊!!!!

    label.font = [UIFont fontWithName:@"Arial" size:13];

    备注:UIFont可设置的字体有这些:

    http://outofmemory.cn/code-snippet/14036/UIFont-setting

    相关文章

      网友评论

        本文标题:UIFont fontWithName中size不生效的原因

        本文链接:https://www.haomeiwen.com/subject/zqhhrctx.html