0
我有一個封閉獲取價值,並加入到numberOfRowsInSection迅速
getCitiesFromServer() { (success, result) in
countТ = Array(success.values).count
}
所以我想用它爲表生成細胞計數:
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return countТ
}
如何從封閉得到countT
並添加到numberOfRowsInSection
?
你應該指定'陣列(成功.values)'到數據源數組,例如'cities'並在'numberOfRowsInSection'中返回'cities.count'。 – vadian