如何返回循環的每個元素。我的意思是我想要顯示這個循環的每個名字來行文本。它只是返回最後一個元素。我怎樣才能返回所有這一切?
如何將循環的每個元素顯示到表格行?
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cellFullname = tableview.dequeueReusableCell(withIdentifier: "cell", for: indexPath as IndexPath)
for last in lastnames {
cellFullname.textLabel?.text = "\(last)"
}
return cellFullname
}
移除循環做這樣的名字[ indexpath.row] – seggy