jonpeter
jonpeter

Reputation: 599

Method does not override any method from its superclass - cell for row at index path

I've tried deleting the override and derived data, re-writing the cell for row at index path function, re-writing the cell variable structure, and no luck. Any idea?

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]
        }
    }
}

Upvotes: 0

Views: 3926

Answers (1)

Mike Schmidt
Mike Schmidt

Reputation: 1065

Methods like cell for row at index path only use the override keyword if they are subclassing UITableViewController. If you are having problems with not being able to override a certain method, then you are most likely not subclassing the right class.

Upvotes: 2

Related Questions