我已经运行的tableView的cellForRowAtIndexPath当这个错误:的TableView细胞错误 - 的iOS /斯威夫特
致命错误:意外发现零而展开的可选值
我不明白,我已经正确分配标识ID,但错误..
这是我的代码:
当覆盖有趣的cellForRowAtIndexPath:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("CellDataflow") as UITableViewCell
cell.textLabel.text = "This is a title."
return cell
}
而这里就是我所说的观点:
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
….more code…
self.navigationController?.pushViewController(MainTVC(), animated: true)
}
注: =>我这样称呼新视图,因为我有一个自定义单元格,而且我无法从故事板中调用它。
感谢
编辑:在该行的错误:
let cell = tableView.dequeueReusableCellWithIdentifier("CellDataflow") as UITableViewCell
嗨感谢您的回答。 但它不是。 在各种测试中,我意识到我记得伤害了新观点。 我试图解释我的机构: - 我有一个自定义单元格的列表。当我点击这个单元格时,我希望你用一个列表进入一个新的视图,但这次单元格不是自定义的。 可能是错误的电话,因为它似乎总是在旧的视图上工作时,我上课MainTVC – uynva 2014-11-03 15:16:36
我不知道我明白你的意思是“始终工作在旧视图”。 – F1ank3r 2014-11-03 15:33:41