问题描述
当我加载填充有自定义(xib)单元格的UITableViewController时,我的应用程序崩溃并显示以下错误:
无法将类型“ SwipeCellKit.SwipeTableViewCell”的值强制转换为“ GreenHarvestAlpha.ListCell”。
但是,ListCell
具有祖父母类SwipeTableViewCell
。
如果我不沮丧,则类ListViewController
将不会连接到自定义单元(并且会收到构建时错误,表明我的自定义单元的属性不存在)。
自定义单元格
class ListCell: SwipeTableViewCell {
滑动课程(使单元出队)
`class SwipeVC: UITableViewController,SwipeTableViewCellDelegate {
override func tableView(_ tableView: UITableView,cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: K.cellSwipeIdentifier,for: indexPath) as! SwipeTableViewCell
cell.delegate = self
return cell }
func updateModel(at indexPath: IndexPath) {
//leave empty. override in CategoryVC & ListVC with delete from realm functionality
}
列表类别(崩溃,出现向下错误):
class ListViewController: SwipeVC
override func tableView(_ tableView: UITableView,cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = super.tableView(tableView,cellForRowAt: indexPath) as! ListCell
此外,我已经覆盖了另一个类中的 prototype 单元,并且该过程正在为此工作。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)