【发布时间】:2021-01-03 04:55:42
【问题描述】:
为什么我会收到这样堆积的文字? 我知道我可以从检查员那里删除“lbl”文本,但我不相信我应该得到这样的东西。 我错过了什么? 提前谢谢你
这是我的代码:
class ViewController: UITableViewController {
let name = [
"a", "b", "c", "d", "e", "f"
]
override func viewDidLoad() {
super.viewDidLoad()
tableView.delegate = self
// Do any additional setup after loading the view.
}
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return name.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "bodyCell", for: indexPath)
cell.textLabel?.text = name[indexPath.row]
return cell
}
}
【问题讨论】:
-
您的单元格中必须添加其他标签。
标签: ios swift uitableview tableview