我已經運行的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