我试过删除覆盖和派生数据,重新编写单元格行索引路径函数,重新编写单元格变量结构,没有运气。任何想法?
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return BPC.count
}
override func tableView(_ tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "BPCCell") as! BPC_TableCell
cell.namelabel.text = BPC[indexPath.row].name
cell.addresslabel.text = BPC[indexPath.row].address
return cell
}
override func prepare(for segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "BPCsegue" {
if let destViewControler = segue.destinationViewController as? BPCDetails {
let indexPath = self.tableView.indexPathForSelectedRow!
destViewControler.details = BPC[indexPath.row]
}
}
}
cell for row at index path
这样的方法只有在子类化UITableViewController
时才使用override
关键字。如果您遇到无法覆盖某个方法的问题,那么您很可能没有创建正确的类的子类。