【发布时间】:2017-05-06 01:44:29
【问题描述】:
如何在 TableView 中显示时忽略数组中的第一项?
我想要的是在 UITableView 中显示时忽略第一项,我不想删除它只是不在 TableView 中显示它。
以下代码显示 TableView 中数组中的所有项目。
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return lists.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "listCell", for: indexPath)
let data = lists[indexPath.row]
cell.textLabel!.text = data.listName
return cell
}
【问题讨论】:
-
您没有显示足够的代码。显示
numberOfRowsInSection。 -
更新帖子。谢谢。
-
为什么没有您的主列表以及表格视图的数据源实际使用的数据模型?
标签: ios arrays swift uitableview