我的视图控制器中有一个表视图控制器。当我给它静态行数和单元格的行索引方法名称时,它在表格视图中对我来说没有任何显示。我也重装表视图,但它没有显示,我不知道为什么会这样,IOS中的表视图中的数据加载问题
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return messages.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell (style: .subtitle, reuseIdentifier: "cellID")
let message = messages[indexPath.row]
cell.textLabel?.text = message.text
return cell
}
你有没有设置'代表及datasource'你的tableview –
你需要设置代表。 –