您的位置:首页 > 产品设计 > UI/UE

UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath

2014-07-01 00:25 387 查看
在处理tabViewCell时报了这个错误 UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath,

错误意思是:必须返回一个cell实例;

网上一搜, 出现这个错误的很多, 但原因也很多:

1. XIB没有连接正确(datasource, delegate), 这种情况比较多;

2. 自定义的tableViewCell未初始化;

而我的情况是第三种:

3. 在cellForRowAtIndexPath()方法中创建cell用的是[tableView
dequeueReusableCellWithIdentifier:identifier];i

而这里的identifier我并没有在xib中的cell中填写, 所以导致这个错, 填上对应的就可以了...

分享下, 希望也能帮到大家, 如有错误理解望指正。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐