将大小设置为自定义iOS字体不起作用 [英] Setting size to custom iOS font doesnt work

查看:302
本文介绍了将大小设置为自定义iOS字体不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的iphone应用中使用了一些自定义字体。它们显示正确,但我无法改变它们的大小。

I am using some custom fonts in my iphone app. They are displayed correctly, but i cant change their size.

以下是为UILabel设置此字体的方法:

Here is how set this font for UILabel:

myLabel.font=[UIFont fontWithName:@"Cabin-Regular" size:18];

此标签是uitableview单元格的一部分,如果它可以扮演任何角色。

This label is part of uitableview cell, if that could play any role.

IB中的标签设置:

我只更改此标签代码中的颜色,文字和字体。

I change only color, text and font in code for this label.

有什么问题?

推荐答案

您确定字体是否正确加载?

Are you sure the font is loaded correctly?

您可以尝试:

for (NSString *familyName in [UIFont familyNames]) {
    NSLog(@"%@", familyName);
    for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
        NSLog(@"\t%@",fontName);
    }
}

这将显示所有加载的字体。确保同名Cabin-Regular显示完全相同。很多时候字体本身没有加载,然后根本不会使用字体大小。

This will show you all the fonts that are loaded. Make sure the same name "Cabin-Regular" is showing up exactly the same. A lot of times the font itself isn't loaded and then the font-size won't be used at all.

这篇关于将大小设置为自定义iOS字体不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆