swift 3.0 自定义UITableViewCell遇到的坑

2017-09-01  本文已影响0人  wsmmint

刚从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一下再运行就好了。

上一篇 下一篇

猜你喜欢

热点阅读