How to check if a font is available in version of iOS?

前端 未结 13 1550
囚心锁ツ
囚心锁ツ 2020-11-27 14:02

I\'m currently working on an app that uses the \"ChalkboardSE-Regular\" font and my deployment target is 4.0+. This font was not available in 4.1 but it is supported in 4.3

13条回答
  •  难免孤独
    2020-11-27 14:27

    Try to init with that font name, and if it's nil do something else. Swift code:

    if let font = UIFont(name: name, size: size) { // ok } else { // not ok }

提交回复
热议问题