如何返回循环的每个元素。我的意思是我想要显示这个循环的每个名字来行文本。它只是返回最后一个元素。我怎样才能返回所有这一切?
如何将循环的每个元素显示到表格行?
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