我正在努力弄清楚这个代码片段有什么问题。这目前在 Objective-C 中有效,但在 Swift 中,这只是在方法的第一行崩溃。它在控制台日志中显示一条错误消息:Bad_Instruction
。
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
var cell : UITableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell") as UITableViewCell
if (cell == nil) {
cell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: "Cell")
}
cell.textLabel.text = "TEXT"
cell.detailTextLabel.text = "DETAIL TEXT"
return cell
}