LoginSignup
2
2

More than 1 year has passed since last update.

タイマー、ストップウォッチ等で使用する文字がぶれる

Posted at

はじめに

ストップウォッチやタイマーなどで動的に動く文字列を使用する際、デフォルトの設定では文字がぶれるような挙動をしてしまいます😭
ezgif.com-gif-maker.gif

等幅フォントに設定しよう!!

そんな時は等幅フォントに設定しましょう😄(すべての文字の幅が同じ幅のフォント)

// 例としてUILabelのフォントを設定(timerMinute: UILabel)
timerMinute.font = UIFont.monospacedDigitSystemFont(ofSize: 50, weight: UIFont.Weight.regular)

これで実行してみましょう😃
ezgif.com-gif-maker (1).gif

いい感じです👍

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