这里有同样的问题(从我读到的内容来看,也许是iOS 8中的错误?),这就是我们的解决方法:
从情节提要中删除原型单元
删除此行:
var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell
替换为以下代码行:
let cellIdentifier =“单元格”
var cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier)as?UITableViewCell 如果单元格== nil { 单元格= UITableViewCell(样式:UITableViewCellStyle.Value2,复用标识符:cellIdentifier) }
let cellIdentifier = "Cell"
var cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier)
if cell == nil {
cell = UITableViewCell(style: UITableViewCellStyle.value2, reuseIdentifier: cellIdentifier)
}
let cell = UITableViewCell(style: UITableViewCell.CellStyle.value2, reuseIdentifier: "cellId")