LoginSignup
1
0

More than 5 years have passed since last update.

InterfaceBuilderにてUILabelのUIFont.TextStyleを指定する方法

Posted at

やりたいこと

以下のUILabelと同じものをXibで再現。

View.swift
let label = UILabel()
label.font = UIFont.preferredFont(forTextStyle: .headline)

同じフォントサイズや太さになるように見える範囲で安易にカスタムして済ませても、端末の設定で文字サイズ変更したときなどに挙動変わってくるのが想像ついてしまう。
Xib上の見た目は諦めておとなしくソースコードで指定してでも条件を同じにしたいところ。

発見

Label > Font > Font にいらっしゃった。
.xcodeprojファイルのパラメータみたいに検索効くと見つけやすいのだけどなぁ・・・

スクリーンショット 2019-01-23 16.04.00.png
スクリーンショット 2019-01-23 16.04.21.png

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