iOS开发中自定义字体

来源:互联网 发布:a计划自动交易软件 编辑:程序博客网 时间:2024/05/16 23:43

从ios32开始我们可以自定义应用程序中的字体。

支持的字体形式:

TrueType-flavoured OpenType (extension .ttf)和

PostScript-flavoured OpenType (extension .otf)

在编程的时候要完成的就四步,很简单。

  1,在Info.plist中加入名为UIAppFonts的array

  2,把*.ttf 和*.otf文件加入到项目当中,比如说是AnnableScript.ttf

  3,把文件名添加到UIAppFonts数组里面

  4,在程序中用下面的命令来调用

  C代码

  // use the font name here, not the filename

  UIFont *myCustomFont = [UIFont fontWithName:@"AnnabelScript" size:30];