6
8

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.

[Swift] UITableViewCellのaccessoryViewのtintColorを変更する

Posted at

Problem

UITableViewCellのaccessoryViewのtintColorを変更したい

Solution

アイコンの取得

以下のサイトから、ic_navigate_nextのpng画像をダウンロードし、ios用のアイコンセットをAssets.xcassetsにドラッグ&ドロップする
https://www.google.com/design/icons/#ic_navigate_next

実装

  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
    let disclosureImage = UIImage(named: "ic_navigate_next")!.imageWithRenderingMode(.AlwaysTemplate)
    let disclosureView = UIImageView(image: disclosureImage)
    disclosureView.tintColor = UIColor.redColor()
    cell.accessoryView = disclosureView
    return cell
  }

結果

スクリーンショット 2015-11-19 3.29.34.png

参考

6
8
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
6
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?