0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Storyboard 上で Attributed Text にカスタムフォントを設定する方法

Posted at

これは何?

Xcodeでプロジェクトにフォントを追加しても、UILabel で Attributedにした際にフォントを設定できなかったので、その対策です。
大したことないんですが、備忘録として投稿します。

対策

結論からゆうと、この場合プロジェクトに追加するだけでなく、Macのフォントブック(FontBook)にもフォントを追加する必要がありました。

作業としては
フォントブックを開き、フォントファイル(ttf)をドラック&ドロップするだけ
です。

これで、Attirbuted状態のUILabelのフォント設定する時に表示されるフォント一覧に、追加したフォントが表示されます。
今回は Noto Sans JP を追加してます。
スクリーンショット 2021-10-16 16.29.03.png

以上です。

参考:
https://stackoverflow.com/questions/25925914/attributed-string-with-custom-fonts-in-storyboard-does-not-load-correctly

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?