2016-04-09 74 views
0

我有一個ViewController和一個lapTableViewController。除了在ViewController中創建數組並在lapTableViewController中調用它之外,我將所有信息都用於教程。Swift問題與TableView

我把lapTableViewController的代碼。我無法弄清楚我錯過了什麼,因爲TableView上沒有顯示任何內容。讓我知道你是否需要更多信息/代碼。

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 
    return newTA.count 
} 

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
    let cellIdentifier = "Cell" 
    let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! lapTableCell 

    //Configure the Cell: 
    cell.numberLabel!.text = newLA[indexPath.row] 
    cell.timeLabel!.text = newTA[indexPath.row] 

    return cell 
} 

override func numberOfSectionsInTableView(tableView: UITableView) -> Int { 
    //Return the number of sections: 
    return 1 
} 

//Hides Status Bar 
override func prefersStatusBarHidden() -> Bool { 
    return true 
} 
+0

編輯您的問題指定問題..它做了什麼?崩潰?不顯示? http://stackoverflow.com/help/how-to-ask – Andrea

+0

對不起,我最初寫這個問題,並搞砸了格式化,必須刪除那部分。剛編輯它! @Andrea –

+0

你如何創建tableview?你有沒有設置它的委託和數據源?數組中有物品嗎? – Paulw11

回答

1

這裏記錄爲完整起見答案:

故事板視圖必須鏈接到從UITableViewController繼承的類(在這種情況下lapTableViewController