LoginSignup
1
2

More than 3 years have passed since last update.

SFSymbolsを大きさと色を変えて表示する

Last updated at Posted at 2021-01-07

はじめに

SFSymbolsを使うことでApple純正アプリでよく見かける画像を簡単にアプリに取り入れることができます。はじめ方についてはこちらで書いています。

let image = let image = UIImage(systemName: "mic")

これだけでマイクアイコンを簡単に貼り付けられます。

大きさと色を変える

let image = UIImage(systemName: "mic", withConfiguration: UIImage.SymbolConfiguration(pointSize: 30, weight: .light, scale: .default))?.withTintColor(.black, renderingMode: .alwaysOriginal)

pointSizeで大きさを、withTintColorで色を変更できます。ボタンを押した際の細かいエフェクトはrenderingModelでいじれます。

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