【发布时间】:2018-03-25 08:37:07
【问题描述】:
如何向已经有左侧详细信息和副标题的单元格添加右侧详细信息。以及如何将 textLabel 赋予正确的细节?
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
let monster = monsters[indexPath.row]
cell.textLabel?.text = monster.name
cell.detailTextLabel?.text = monster.subtitle
return cell
}
【问题讨论】:
-
您在使用情节提要吗?
-
我正在关注本教程...here。但我希望每个单元格都有左侧细节、右侧细节和副标题。
-
深入自定义单元格。尝试在 dequeue 方法中添加自定义类单元格。
-
基本单元格中不能有左细节和右细节。您需要为此使用自定义单元格。 @MartinMuldoon 刚刚解释了如何做到这一点。
标签: ios swift uitableview