2014-09-04 38 views
0

我想在Swift語言中自定義Tableview單元格中分配文本。但它給錯誤消息:「致命錯誤:意外發現零而展開的可選值」UITableView自定義單元格iPhone使用Swift語言

http://i.stack.imgur.com/333xS.png

+0

您的名字TableVIew中有一個很大的「i」。那是對的嗎? – derdida 2014-09-04 08:56:32

+0

雅,這是正確的。在Swift中,除了「func tableView(tableView:UITableView !, cellForRowAtIndexPath indexPath:NSIndexPath!) - > UITableViewCell!」函數外,不支持「DequeueReusableCellWithIdentifier」函數 – 2014-09-04 09:56:30

回答

0

不應該有在標識符字段中輸入錯誤的標識符的error.check。

0

您應該使用下面的UITableView數據源方法中的代碼行。您的代碼應如下所示:

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 

var cell: BlogTableCell! = tableVIew.dequeueReusableCellWithIdentifier("BlogTableCell") as! BlogTableCell 

}