Last active
May 23, 2018 06:39
-
-
Save k-yamada/1ee518a097e22417c7b68ad24a6332dd to your computer and use it in GitHub Desktop.
カスタムUITableViewCellの選択時の背景色を変更する ref: https://qiita.com/k-yamada-github/items/a589fca3b68847bc3a99
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CustomCell.swift: | |
import UIKit | |
class CustomCell: UITableViewCell { | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
backgroundColor = UIColor(named: "primary") | |
selectedBackgroundView = makeSelectedBackgroundView() | |
} | |
private func makeSelectedBackgroundView() -> UIView { | |
let view = UIView() | |
view.backgroundColor = UIColor(named: "primary_light") | |
return view | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment