0
相應部分下
問題:下面提到的代碼填充兩者的區段值,其中它應該根據有關節頭填充(第即:主動和Finished)顯示列表中夫特3
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cellIdentifier = "MainTableViewCell"
let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! MainTableViewCell
DispatchQueue.main.async{
let theGame = self.game[indexPath.row]
if (theGame.status == "Finished")
{
let finishedGame = theGame
cell.userName?.text = finishedGame.myTeamState.team.players[1].username
}
else{
let otherGame = theGame
cell.userName?.text = otherGame.myTeamState.team.players[1].username
}
}
return cell
}
我認爲,我無法理解如何讓標題部分在其中嵌套值/填充列表。
在此先感謝。
我已經加入他們 FUNC numberOfSections(在的tableView:的UITableView) - >內部{ 返回2 } FUNC的tableView(_的tableView:UITableView的,numberOfRowsInSection部的:int) - >內部{ 返回gameList.count } – Prateekro
這是不正確的。您需要在每個部分添加確切的行數。最好將數組分隔成活動和完成的數組。 –
謝謝。你能不能請telI,將數組分成兩部分。我如何需要將部分列表添加到部分。 這將是一個很大的幫助。 – Prateekro