UITableView에서 인덱스 범위를 벗어나는 문제가 있습니다. 배열의 배열치명적인 오류 : 인덱스가 범위를 벗어났습니다.
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 50
}
//== Teble: number of tables ==============================//
func numberOfSections(in tableView: UITableView) -> Int {
return headerTitleArray.count
}
//== Teble rows: number of rows ==============================//
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return cellTitleMultiArray.count
}
//== Teble rows: data for each row ==============================//
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CustomCell", for: indexPath) as! CustomTableViewCell
let text = cellTitleMultiArray[indexPath.section][indexPath.row]
cell.titleLabel.text = text
return cell
}
}
나는이 문제를 해결하기 위해 노력하고 있지만, 내가이 문제를 해결하는 데 도움이 바랍니다 호야 없습니다 .... 그것은 당신의 cellTitleMultiArray
처럼 보이는
올바른 'return cellTitleMultiArray.count'입니까? 너는 네가 원하는 것처럼 들린다. 난 그게'return cellTitleMultiArray [section] .count'이어야한다고 생각합니다. –
'return cellTitleMultiArray.count' =>'return cellTitleMultiArray [indexPath.section] .count' – Larme
cellTitleMultiArray [section] .count도 시도했지만 충돌합니다. –