UIKit - UITableViewCell 클릭 시 색상 변경 제거하기
UIKit - UITableViewCell 클릭 시 색상 변경 제거하기
현재는 아래와 같이 TableViewCell을 클릭할 경우 색상이 변경됨.
이를 selectionStyle 프로퍼티를 설정하여 해결할 수 있음.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
extension BookListViewController: UITableViewDataSource, UITableViewDelegate{
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: BookListTableViewCell.identifier, for: indexPath) as! BookListTableViewCell
...
// 클릭 시 나타나는 효과 제거
cell.selectionStyle = .none
return cell
}
}
결과
Reference
This post is licensed under CC BY 4.0 by the author.

