【发布时间】:2017-02-25 00:30:31
【问题描述】:
'NSInternalInconsistencyException',原因:'无法使具有标识符 eventCell 的单元格出列 - 必须为标识符注册一个 nib 或类或连接情节提要中的原型单元格'
这是代码
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {// this sets the title and subtitle to the Title and Location in the given EventPlan
let cell = tableView.dequeueReusableCell(withIdentifier: "eventCell ", for: indexPath) as UITableViewCell
cell.textLabel?.text = eventsArray[indexPath.row].title
cell.detailTextLabel?.text = eventsArray[indexPath.row].location
return cell
}
// here's my code for eventplan
class EventPlan : NSObject {
var title:String
var location:String
init(tits: String, locs: String){
self.title = tits
self.location = locs
}
}
let event = EventPlan(tits: "Wise BDAY", locs: "UVA-Wise")
我知道我应该在我的主故事板上将单元格标识符标记为 eventCell,但我仍然收到错误消息。我连接不正确吗?
【问题讨论】:
标签: ios swift uitableview