【发布时间】:2022-01-04 20:45:37
【问题描述】:
我正在做一个程序化的 Swift 应用程序,但在使用 tableView.dequeueReusableCell 时找不到向单元格添加 style: .subtitle 的方法。
在下面的代码中,我希望能够将样式设置为 .subtitle:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
...
return cell
}
我尝试添加以下内容,但不能与 dequeue 结合使用:
var cell = UITableViewCell(style: .subtitle, reuseIdentifier: "cell")
添加这个的正确方法是什么?
【问题讨论】:
标签: swift uitableview