美文网首页
Swift 解决unable to dequeue a cell

Swift 解决unable to dequeue a cell

作者: MambaHJ | 来源:发表于2018-03-28 00:01 被阅读10次
    • 新开了个坑,记录开发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换成你自己定义的名字即可

    相关文章

      网友评论

          本文标题:Swift 解决unable to dequeue a cell

          本文链接:https://www.haomeiwen.com/subject/ckmecftx.html