3

请告诉我如何向 iphone xcode3.2 添加新字体。

4

4 回答 4

8

此功能未内置在 iOS < 3.2 中的 UILabel/UIFont 中。但是您可以使用第三方解决方案:FontLabel

在 iOS 3.2+ 中,有UIAppFonts plist 键

在使用它之前执行此操作:将您的字体文件(例如myfont.ttf)添加到您的项目中,然后像这样编辑 Info.plist:

信息列表

于 2010-07-28T05:26:04.077 回答
2

上述方法在 xcode 3.2 中对我有用!谢谢!:

第 1 步:将字体拖到项目中(最好不要在字体名称中包含空格) 第 2 步:在 info.plist 文件中添加一行,如上所示以输入字体。第 3 步:在 viewDidLoad() 或您设置标签的任何位置,输入代码:

 UIFont *myFont = [UIFont fontWithName:@"secondbreakfast" size:40];
 myLabel.font = myFont;
于 2012-06-14T18:04:31.600 回答
0

我是通过以下方式做到的:

  1. 在 Xcode 中添加字体类型:在 XIB 下,进入字体设置 -> 管理字体

  2. 将字体添加到标签:

    UIFont *myFont = [UIFont fontWithName:@"myfont" size:12]; 标签.font = myFont;

希望有帮助

于 2011-03-22T16:50:43.357 回答
0

但在 xcode 5

  1. 转到xcode preferences-> Fonts and colors
  2. 然后单击字体T中的按钮。textField

打开所有颜色的列表,然后单击setting button左下角并转到manage fonts

在这里选择All fonts然后ttf file通过单击添加您自己的plus button 字体,您的字体将被添加。

于 2012-03-04T12:15:59.527 回答