LoginSignup
4
2

More than 5 years have passed since last update.

UILabelにグローをかけて光らせる

Posted at

UILabelがキリッ!としすぎていたので、ボアーッと光ったようにしたいなーと思って調べたところ、CoreGraphics?を使ってできることがわかったのでシェアします。

キリッ!としたラベルが
スクリーンショット 2016-11-07 11.03.14.png

こうなる
スクリーンショット 2016-11-07 11.02.44.png
ボア〜

参考にしたのはこちらのサイト

コードはたったこれだけ

testLabel.layer.shadowColor = UIColor.white.cgColor
testLabel.layer.shadowRadius = 4.0
testLabel.layer.shadowOpacity = 1.0
testLabel.layer.shadowOffset = CGSize.zero

色、半径、透明度、光の発射地点でカスタマイズ可能。

ゲーム制作だったらBMFontていう便利なものが使えたけど、UIKitには使えないっぽいですね。

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