특정 Static Cell 제거
Static Cels에 정의된 TableView에서 녹색 cell 제거
셀의 하이라이트를 0으로 설정합니다.
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.row == 4 {
return 0
}
return super.tableView(tableView, heightForRowAt: indexPath)
}
하이라이트를 0으로만 설정했기 때문에 스토리보드에 녹색 셀은 계속 저장됩니다.징그럽다.cell 불러오기 건너뛰기
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return super.tableView(tableView, numberOfRowsInSection: section) - 1
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row > 3 {
return super.tableView(tableView, cellForRowAt: IndexPath(row: indexPath.row + 1, section: 0))
}
return super.tableView(tableView, cellForRowAt: indexPath)
}
상기 방법보다 코드량이 많지만 쓸모없는cell을 불러오는 비용이 줄어든다.
Reference
이 문제에 관하여(특정 Static Cell 제거), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/hofzzy/items/fffcd89bd913e2c247d3텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)