如何解决使用覆盖将SwipeCellKit连接到自定义单元格-Swift
当我加载填充有自定义(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 举报,一经查实,本站将立刻删除。