Could Not Cast Value of Type 'Uitableviewcell' to '(Appname).(Customcellname)'

Could not cast value of type 'UITableViewCell' to 'AppName.CustomCellName'

"I have self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "eventCell") in my viewDidLoad"

That's probably overriding the value you set in the storyboard. Try removing this line, or change it to self.tableView.registerClass(EventTableViewCell.self, forCellReuseIdentifier: "eventCell").

Could not cast value of type 'UITableViewCell' to 'PFTableViewCell'

Did you change the class of the prototype cell to: PFTableViewCell ?

The identifier only helps you, well, identify the cell on the storyboard for the current table view.

can't set UITableViewCell as a cell

you are using the old decking method, that either rquires you to create the cell or use the new that takes the indexPath

let cell:customCell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath:indexPath) as! customCell

if it is still failing, you need to register the cell, either by setting it up in the storyboard or by registering either a class or a nib file in code.

override func viewDidLoad() {
super.viewDidLoad()
tableView.registerNib(UINib(nibName: "customCell", bundle: nil), forCellReuseIdentifier: "cell")
}

or

override func viewDidLoad() {
super.viewDidLoad()
self.tableView.registerClass(customCell.self, forCellReuseIdentifier: "cell")
}


Related Topics



Leave a reply



Submit