BackgroundView
cell.selectedBackgroundView라는 프로퍼티가 존재한다. 이것은 선택된 cell의 뒤에만 동적으로 배치되므로 배경색같은거 설정할때 활용된다
let backgroundView = UIView()
backgroundView.layer.cornerRadius = 10
backgroundView.backgroundColor = .systemBlue
selectedBackgroundView = backgroundView
그 외
cell.setSelected() 메서드를 override하여 제어할 수 있다
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
if selected {
titleLabel.textColor = .white
dateLabel.textColor = .white
previewLabel.textColor = .white
} else {
titleLabel.textColor = .label
dateLabel.textColor = .label
previewLabel.textColor = .systemGray
}
}