2017-02-21 124 views
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   
} 
+0

可能是你的電池'nil',檢查其創建 – sasquatch

+2

你確定你有'eventsArray'中有足夠的元素?如果'indexPath.row'是8,那麼你需要9個元素,等等。 – Connor

回答

0
在你行的部分數據源的呼叫數

,確保你回國eventsArray.count