iOS 15 가 나오고 Xcode 13이 나오면서 textLabel에 deprecated 가 떴다.
Apple Developer Documentation
developer.apple.com
그래서 테이블 셀 내용 호출하는 방식이 달라졌다.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "MessageCell", for: indexPath)
// 달라진 방식(iOS 14.0 이상)
if #available(iOS 14.0, *) {
var content = cell.defaultContentConfiguration()
content.text = self.comments[indexPath.row].message
cell.contentConfiguration = content
} else {
// 기존과 동일(iOS 14.0 까지만 지원)
cell.textLabel?.text = self.comments[indexPath.row].message
}
return cell
}
'iOS > 문제 해결' 카테고리의 다른 글
p12로 개발 인증서 내보내기 (3) | 2021.11.05 |
---|---|
iOS 기존의 프로젝터에 코어데이터 추가하기 (0) | 2021.08.13 |