我想用下面给出的代码注册一个类,UITableViewCell。我在调用方法viewDidLoad中registerClass:forCellReuseIdentifier:在swift中不工作
tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "SearchResult")
但是,当我尝试杜克细胞,我得到无细胞。此代码正在我的视图控制器扩展(扩展实现tableview的协议)中调用。
var cell: UITableViewCell! = tableView.dequeueReusableCellWithIdentifier("SearchResult")
错误:
fatal error: unexpectedly found nil while unwrapping an Optional value
任何想法,我做错了这里。
谢谢。
你有tableviewcell笔尖(厦门国际银行)文件? –
你在哪里调用registerClass? –
'让电池= tableView.dequeueReusableCellWithIdentifier(“信息搜索结果”,forIndexPath:indexPath)' – Ian