프로젝트에 UITableView 컨트롤러가 있습니다. 그래서 내가 여기에 같은있는 UITableViewCell 설정을 만들어 : 자신의 인덱스가있는 tableview가 나타납니다 2.UITableViewCell의 배경 설정이 스크롤 할 때 재설정됩니다.
로 나눌 수없는 경우
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
cell.textLabel?.text = "Section: \(indexPath.section). Row: \(indexPath.row)."
if indexPath.row % 2 == 1 {
cell.backgroundColor = UIColor.gray
}
return cell
}
내가 내있는 tableview의 세포가 회색으로 원하는 모든 것이 완벽하다! 그러나 위아래로 스크롤하면 세포가 회색으로 변하기 시작합니다.
결국 내 모든 세포는 회색입니다.
는 여기에 몇 가지 이미지입니다 : 세포가 재사용되기 때문에
감사합니다 많이) 그것은 너무 쉬웠다) :! D –
@AlexVihlayev 없음 문제 메이트. :) –