Iphone 自定义字体在iOS 5中不起作用

Iphone 自定义字体在iOS 5中不起作用,iphone,ios,ipad,ios5,uifont,Iphone,Ios,Ipad,Ios5,Uifont,我在参考资料中添加了Avenir-Next-LT-Pro-Demi-Condensed_5186.ttf字体。还将相同的字体添加到my info.plist中应用程序提供的字体中。 在我的代码中,我设置了如下字体 titleLabel.font = [UIFont fontWithName:@"Avenir-Next-LT-Pro-Demi-Condensed_5186" size:10]; 但这在ios 5模拟器和设备中不起作用。您必须检查字体名称,它有时与字体文件名不同 从获得答案您必须

我在参考资料中添加了Avenir-Next-LT-Pro-Demi-Condensed_5186.ttf字体。还将相同的字体添加到my info.plist中应用程序提供的字体中。 在我的代码中,我设置了如下字体

titleLabel.font = [UIFont fontWithName:@"Avenir-Next-LT-Pro-Demi-Condensed_5186" size:10];

但这在ios 5模拟器和设备中不起作用。

您必须检查字体名称,它有时与字体文件名不同


获得答案您必须检查字体名称,它有时与字体文件名不同

得到答案试试这个

The font name is not the font file name 

Avenir-Next-LT-Pro-Demi-Condensed_5186.ttf is a file name. simply double click the Avenir-Next-LT-Pro-Demi-Condensed_5186.ttf file it will automatically  open the font reader.Get the font name from top of the font reader navigation bar..
试试这个

The font name is not the font file name 

Avenir-Next-LT-Pro-Demi-Condensed_5186.ttf is a file name. simply double click the Avenir-Next-LT-Pro-Demi-Condensed_5186.ttf file it will automatically  open the font reader.Get the font name from top of the font reader navigation bar..

按照下面给出的步骤操作

1.确保复制字体时选中了“添加到目标”复选框

2.首先在finder中选择字体显示,然后双击don,确保字体名称必须与like图像相同

这里的字体名称为“iseurofurence light”

3.将字体添加到.plist文件中

4.完成所有工作后,检查字体--

 NSLog(@"%@",[UIFont fontNamesForFamilyName:@"Your font"]);
根据字体系列使用粗体和斜体


希望这将对您有所帮助

按照下面给出的步骤进行操作

1.确保复制字体时选中了“添加到目标”复选框

2.首先在finder中选择字体显示,然后双击don,确保字体名称必须与like图像相同

这里的字体名称为“iseurofurence light”

3.将字体添加到.plist文件中

4.完成所有工作后,检查字体--

 NSLog(@"%@",[UIFont fontNamesForFamilyName:@"Your font"]);
根据字体系列使用粗体和斜体


希望这能对你有所帮助

我只想补充一点,这并非总是遵循这条规则。最好的方法是在应用程序中注册字体,并执行快速检查和验证字体名称

目标-c

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

 for familyName in UIFont.familyNames() {
        for fontName in UIFont.fontNamesForFamilyName(familyName){
            print(fontName)
        }
    }

我只是想补充一点,并不是所有的时间都遵循这个规则。最好的方法是在应用程序中注册字体,并执行快速检查和验证字体名称

目标-c

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

 for familyName in UIFont.familyNames() {
        for fontName in UIFont.fontNamesForFamilyName(familyName){
            print(fontName)
        }
    }

首先检查您是否编写了正确的字体名。我已将字体名设置为Avenir-Next-LT-Pro-Demi-Condensed_5186,因为文件名为same@Akhildas这不是一个正确的假设。使用FontBook打开字体时,请检查显示的名称。如果无法安装它们,它们有什么用?可以使用类方法familyNames for UIFont检查字体的正确名称。首先检查您是否编写了正确的字体名称。我已将字体名称设置为Avenir-Next-LT-Pro-Demi-Condensed_5186,因为文件名为same@Akhildas这不是一个正确的假设。使用FontBook打开字体时,请检查显示的名称。如果无法安装它们,那么它们有什么用?可以使用类方法familyNames for UIFont检查字体的正确名称。