4
5

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 5 years have passed since last update.

StoryBoardでUIImageViewのtintColorを変更する

Last updated at Posted at 2015-11-19

Solution

// MyImageView.swift:

import UIKit

@IBDesignable
class MyImageView: UIImageView {
  @IBInspectable internal var tintColorCode: String = "" {
    didSet {
      image = image?.imageWithRenderingMode(.AlwaysTemplate)
      tintColor = MyColor.fromCode(tintColorCode)
    }
  }
}

ColorCodeで色を指定する方法は以下を参考にして下さい

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?