オーバーライドと派生データの削除、インデックスパス関数の行のセルの再書き込み、セルの可変構造の再書き込み、運がない。何か案が?彼らはUITableViewController
をサブクラス化している場合cell for row at index path
ようメソッドはスーパークラスのメソッドをオーバーライドしません - インデックスパスの行のセル
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]
}
}
}
を? – Harsh
なぜ 'didSelectRowAtIndexPath'を使用できませんか? – jo3birdtalk
テーブルビューコントローラをサブクラス化しているのですか、またはテーブルビューのデータソースを実装していますか? 「オーバーライド」を使用すると、サブクラスが示唆されます。あなたは何をしているのですか? – ghostatron