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
}
编辑您的问题指定问题..它做了什么?崩溃?不显示? http://stackoverflow.com/help/how-to-ask – Andrea
对不起,我最初写这个问题,并搞砸了格式化,必须删除那部分。刚编辑它! @Andrea –
你如何创建tableview?你有没有设置它的委托和数据源?数组中有物品吗? – Paulw11