2014-09-04 65 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 

}