Abr*_*m P 1 uitableview ios swift
我正在尝试构建一个相当直接的数据表,并遵循本教程:http : //www.raywenderlich.com/87975/dynamic-table-view-cell-height-ios-8-swift
我有以下自定义单元格类:
import Foundation
import UIKit
class WorkItemCell: UITableViewCell {
@IBOutlet var titleLabel: UILabel!
}
Run Code Online (Sandbox Code Playgroud)
以及我的 TableClass 中的以下函数:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCellWithIdentifier("WorkItemCell") as! WorkItemCell
cell.textLabel?.text = self.work[indexPath.row]["name"] as! String
return cell
}
Run Code Online (Sandbox Code Playgroud)
这导致:
Could not cast value of type 'UITableViewCell' (0x10c111c68) to 'proj.WorkItemCell' (0x10a84c4c0).
为什么?我该如何解决?
| 归档时间: |
|
| 查看次数: |
3596 次 |
| 最近记录: |