LoginSignup
2
3

More than 5 years have passed since last update.

Xcodeカスタムフォント

Posted at

カスタムフォントを使う時に間違ってしまうのでメモ。

コードで利用する名前の確認方法

Font Book を起動して、フォントを選んで「i」を選択

ss01.png

フォントの情報が表示される

  • PostScript名
  • 正式名称
  • ファミリー
  • スタイル etc.

「正式名称」ではなく「 PostScript名 」を確認して

UIFont.init(name: "PostScript名", size: 12)

注意点として、UIFontのinitはオプショナル

init?(name fontName: String, size fontSize: CGFloat)

なので間違って「正式名称」や「ファミリー」を指定するとnilになるので「!」してるとクラッシュします。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3