iOS: Programmatically add custom font during runtime

后端 未结 4 1550
醉酒成梦
醉酒成梦 2020-12-01 05:01

I would like to allow my application users to use their own fonts in the app, by copying them inside the Documents directory (through iTunes). However, I can\'t find a way t

4条回答
  •  無奈伤痛
    2020-12-01 05:25

    There is a class created by the guys at Zynga which makes it possible to load any custom fonts: FontLabel.

    You have to call [FontManager loadFont:] in your application startup (for example in your app delegate) for each font that you want to use in your app.

    Therefore is non-trivial to iterate in the Documents folder looking for .ttf files (the library works only with ttf font).

    A little notice: this class use a subclass of UILabel.

提交回复
热议问题