【发布时间】:2018-08-11 14:26:21
【问题描述】:
现在我知道还有很多其他问题存在同样的问题,但是,它们都没有在我的问题上崩溃。
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "customCell") as! CustomTableViewCell
cell.selectionStyle = UITableViewCellSelectionStyle.none
cell.cellView.layer.cornerRadius = cell.cellView.frame.height / 2
cell.animalLbl.text = elements[indexPath.row]
cell.animalImage.image = UIImage(named: elements[indexPath.row])
cell.animalImage.layer.cornerRadius = cell.animalImage.frame.height / 2
return cell
}
返回单元格
这就是导致我的问题的原因。我的数组只有 10 个项目长,它在模拟器上运行良好。在我将所有图像添加到表格视图中之前,它在我的 iPad 上也可以正常工作。
这是我的数组:
let elements = ["The Perfect Apps", "Soft Boiled", "Medium Boiled", "Hard Boiled", "Scrambled","Fried", "Poached", "Rate", "Credits","Website"]
【问题讨论】:
-
你能显示元素数组吗?
-
我已经添加了数组@Sh_Khan
-
请不要发布代码图片。
标签: ios swift uitableview cocoa-touch