Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix "method does not override any method from its superclass."?

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    let cellIdentifier = "Cell"
    let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! CustomTableViewCell

    // Configure the cell...
    cell.nameLabel.text = restaurantNames[indexPath.row]
    cell.thumbnailImageView.image = UIImage(named: restaurantImages[indexPath.row])
    cell.locationLabel.text = restaurantLocations[indexPath.row]
    cell.typeLabel.text = restaurantTypes[indexPath.row]

    cell.accessoryType = restaurantIsVisited[indexPath.row] ? .Checkmark : .None

    // Circular image
    cell.thumbnailImageView.layer.cornerRadius = cell.thumbnailImageView.frame.size.width / 2
    cell.thumbnailImageView.clipsToBounds = true

    return cell
}
like image 812
Ebin Avatar asked Sep 19 '15 18:09

Ebin


2 Answers

Just remove override word from your editActionsForRowAtIndexPath and commitEditingStyle function declarations.

like image 70
mkz Avatar answered Oct 05 '22 04:10

mkz


You should share your full class. Although, it seems that you are NOT OVERRIDING any method from your base class. Simple remove the override keyword from your method, or identify the correct BaseClass in which an Overridable method with the same signature(that you want to override) exists and then properly use the extends keyword.

I think you should first google the terms: MethodOverriding, BaseClass(or SuperClass)

like image 26
Anshuman Chatterjee Avatar answered Oct 05 '22 02:10

Anshuman Chatterjee