Swift 解决unable to dequeue a cell with identifier dictCell - must register a nib or a class for the identifier

  • 新开了个坑,记录开发ios时遇到的坑,以及解决bug的方法
  • bug: unable to dequeue a cell with identifier dictCell - must register a nib or a class for the identifier
    这个bug是因为和同学合作开发app时因为一开始没用git,所以中途得整合一下代码,他直接把我的tableViewController复制过去,导致dictCell也就是自己定义的tableViewCell无法使用.
    解决方法很简单,bug提示说must register a nib or a class for the identifier,那就调用下面这行代码,把它放进override func viewDidLoad(){}函数中
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "newDictCell")
  • UITableViewCell和newDictCell换成你自己定义的名字即可
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容