I have made a ViewController
, in that ViewController
, I have made a TableView
, in the TableView
I have added a TableViewCell
.
In the TableViewCell
, I have added a text label and an image.
Iv'e made a cocoa touch file named customCell
and connected it with the TableView Cell.
In the ViewController
file I wrote this:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell:customCell = tableView.dequeueReusableCellWithIdentifier("cell") as! customCell
cell.imageCountry.image = UIImage(named: "2xd.png")
cell.nameCountry.text = "hey"
return cell
This is what i wrote in the customCell file: import UIKit
class customCell: UITableViewCell {
@IBOutlet var imageCountry: UIImageView!
@IBOutlet var nameCountry: UILabel!
}
Iv'e connected the TableView & the ViewController with the DataSource & Delegate. When I run my code this is the error I get:
Could not cast value of type 'UITableViewCell' (0x10d1119f0) to 'refreshing.customCell' (0x10b2f6dd0).
*refreshing is the name of the project.
And the green line of the bugger is set to this line:
let cell:customCell = tableView.dequeueReusableCellWithIdentifier("cell") as! customCell
Any suggestions?