동일한 Collectionviewcell에 두 개의 tableview가 있습니다. 나는 응용 프로그램을 실행할 때, 그것을있는 tableview의 cellforrowatindexpath에 충돌 말한다 : "치명적인 오류가 : 선택 사양 값 풀기 동안 예기치 않게 전무 발견"그것은 tableview의 cellforrowatindexpath에서 충돌합니다 : "치명적인 오류 : 선택 값을 래핑하는 동안 예기치 않게 nil이 발견되었습니다"
내 코드의 일부를 검색 -
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) ->
UITableViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier:
reuseIdentifier, for: indexPathOfCollectionView as IndexPath) as!
MyCustomCollectionViewCell
if(tableView == cell.graphTableView){
let cell:CustomGraphTableViewCell =
tableView.dequeueReusableCell(withIdentifier: "CustomGraphTableViewCell") as!
CustomGraphTableViewCell
return cell
}
else
{
let cell:MyCustomTableViewCell =
tableView.dequeueReusableCell(withIdentifier: "MyCustomTableViewCell") as!
MyCustomTableViewCell
cell.nameLabel.text = namesArray[indexPath.row]
return cell
}
}
수있는 사람하시기 바랍니다 해결책을 제안하십시오. 왜 그런 일이 일어나고 있으며 무엇을 해결할 수 있을까요?
당신이'CollectionViewCell''를 큐에서 수를 TableView'cellForRowAt' 메소드. –
당신은 "여기에 강제로 언 래핑을합니다!" 귀하의 모든 셀을 확인하십시오. 왜냐하면 지금은 그것의 nil –
@ NiravD 어떤 생각 그럼 어떻게 내가 collectionview 세포를 선언하지 않으면 tableview에 액세스 할 수 있습니까? –