当我创建一个新的UITableView时,我可以设置 cell.imageView。理论上,这不是应该显示图像吗?是在 a 中实际显示图像UITableViewCell以创建自定义单元子类的唯一方法吗?
这是我正在使用的代码:
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell = UITableViewCell (style: UITableViewCellStyle.value1, reuseIdentifier: "cell")
cell.textLabel?.text = practices[indexPath.row].name
cell.detailTextLabel?.text = practices[indexPath.row].address?.displayString()
//this doesn't show an image
cell.imageView?.clipsToBounds = true
cell.imageView?.contentMode = .scaleAspectFill
cell.imageView?.image = practices[indexPath.row].logo
return (cell)
}