0
所以即时尝试填充我的表中的行与存储在“事件”数组中的信息。其中事件是具有位置和标题数据的对象。由于某种原因,我得到了一条糟糕的指令错误线程1在线评论。任何想法为什么?使用数据填充表格视图
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: Storyboard.EventCellIdentifier, for: indexPath)
cell.textLabel?.text = eventsArray[indexPath.row].title // Error here
cell.detailTextLabel?.text = eventsArray[indexPath.row].location
return cell
}
可能是你的电池'nil',检查其创建 – sasquatch
你确定你有'eventsArray'中有足够的元素?如果'indexPath.row'是8,那么你需要9个元素,等等。 – Connor