0
그래서 2 개의 사용자 정의 셀이있는 테이블 뷰를 만들었습니다.여러 개의 TableView 사용자 정의 셀
제 3의 셀에 데이터를 입력하려고하는데, 제 3의 셀에서 얼마나 많은 셀을 반환 할 때 &도 제 제목 배열을 시작하는 데 문제가 있습니다. 마지막 경우
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var row = indexPath.row
if(row == sliderIndex){
var cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! Row
return cell
}else if (row == instagramIndex) {
var cell2 = tableView.dequeueReusableCell(withIdentifier: "instgramCell", for: indexPath) as! Insta
return cell2
} else {
var cell3 = tableView.dequeueReusableCell(withIdentifier: "blogCell", for: indexPath) as! blogCell
if (row == 3) {
cell3.blogTitle.text = titleArray[0]
}
return cell3
}
수 나는'sliderIndex = 0'과'instagramIndex = 1'을 추측 했는가? 그런 다음'numberOfRows'는'titleArray.count + 2'와 같고'else'의 경우'cell3.blogTitle.text = titleArray [row-3]'또는 그와 비슷한 것 (+ 1 또는 -1. – Larme