美文网首页
swift 3.0 自定义UITableViewCell遇到的坑

swift 3.0 自定义UITableViewCell遇到的坑

作者: wsmmint | 来源:发表于2017-09-01 15:21 被阅读0次

刚从oc转swift一个周,基础还没打牢

我跟随朝辉大大的脚步用他写的30个swift小项目进行练习

写到第三个Project 3 - Play Local Video的时候遇到了一些小问题

其中tableView和Cell是在storyboard上面拖进去的,同时创建了一个名为VideoCell的自定义手写cell

在把delegate,dataSource写好后

运行一直crash,给出的提示是“unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard

到最后才找到原来storyboard里cell对应的identifier一栏,需要填上你在代码里写的对应identifier

可能这个时候你运行还是会crash,不用担心只要clean一下再运行就好了。

相关文章

网友评论

      本文标题:swift 3.0 自定义UITableViewCell遇到的坑

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