Reputation: 53
I want to change this code:
override func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
}
like that:
override func tableView(tableView: UITableView, didEndDisplayingCell cell: CustomCell, forRowAtIndexPath indexPath: NSIndexPath) {
}
but I receive an error message. I need to change my CustomCell when it disappears. How can I handle this ?
Upvotes: 1
Views: 1399
Reputation: 66252
Use the original method signature, and use optional casting to access CustomCell
:
override func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
if let cell = cell as? CustomCell {
// do something with cell
}
}
Upvotes: 5