func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
if let header = view as? UITableViewHeaderFooterView {
header.tintColor = ThemeManager.current.mainBackgroundColor
header.textLabel?.textColor = ThemeManager.current.oppositeColor
}
}
테이블뷰를 나누는 섹션의 텍스트컬러와 배경컬러는 view as? UITableViewHeaderFooterView를 통해서 배경색은 header.tintColor, 텍스트컬러는 header.textLabel.textColor를 통해 바꿀 수 있습니다.
'iOS Swift > Today I Learned' 카테고리의 다른 글
이메일, 핸드폰번호 마스킹하기 (1) | 2023.02.02 |
---|---|
hitTest 활용하여 터치이벤트 확인하기 (0) | 2023.01.13 |
filter 및 tableView section 활용하기 (0) | 2022.12.30 |
CIImage, CGImage, UIImage 변환 및 개념 정리 (0) | 2022.12.28 |
DateFormatter 활용해보기 (0) | 2022.12.27 |