Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在swift中继承tableview单元deque错误_Swift_Xcode_Uitableview - Fatal编程技术网

在swift中继承tableview单元deque错误

在swift中继承tableview单元deque错误,swift,xcode,uitableview,Swift,Xcode,Uitableview,我有一个UITableview单元格及其.xib,名为BaseTableviewCell,其中我定义了标签等组件的出口,按钮等。我有另一个名为CustomTableviewCell的类,它继承了BaseTableviewCell,并对基表中定义的插座执行各种操作 我的问题是如何在tableview控制器中注册和取消自定义TableViewCell 我使用了下面的,它工作不正常,导致应用程序崩溃 tableview.register(UINib(nibName: "BaseTableviewCel

我有一个UITableview单元格及其.xib,名为BaseTableviewCell,其中我定义了标签等组件的出口,按钮等。我有另一个名为CustomTableviewCell的类,它继承了BaseTableviewCell,并对基表中定义的插座执行各种操作

我的问题是如何在tableview控制器中注册和取消自定义TableViewCell

我使用了下面的,它工作不正常,导致应用程序崩溃

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是的,我已经按照代码段中的操作完成了