在swift中继承tableview单元deque错误
我有一个UITableview单元格及其.xib,名为BaseTableviewCell,其中我定义了标签等组件的出口,按钮等。我有另一个名为CustomTableviewCell的类,它继承了BaseTableviewCell,并对基表中定义的插座执行各种操作 我的问题是如何在tableview控制器中注册和取消自定义TableViewCell 我使用了下面的,它工作不正常,导致应用程序崩溃在swift中继承tableview单元deque错误,swift,xcode,uitableview,Swift,Xcode,Uitableview,我有一个UITableview单元格及其.xib,名为BaseTableviewCell,其中我定义了标签等组件的出口,按钮等。我有另一个名为CustomTableviewCell的类,它继承了BaseTableviewCell,并对基表中定义的插座执行各种操作 我的问题是如何在tableview控制器中注册和取消自定义TableViewCell 我使用了下面的,它工作不正常,导致应用程序崩溃 tableview.register(UINib(nibName: "BaseTableviewCel
tableview.register(UINib(nibName: "BaseTableviewCell",
bundle: nil ),
forCellReuseIdentifier: "CustomTableviewCell")
在cellForRowAt,我写了以下内容
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CustomTableviewCell", for: indexPath) as! CustomTableviewCell
return cell
}
请帮助我找出哪里出了问题,并解决此问题我想注册CustomTableviewCell而不是BaseTableviewCell是您已经尝试过的事情,并且您重新检查了您的.xib名称,对吗?@SavcaMarin是的,我已经按照代码段中的操作完成了