今天在cell重用的时候出现一下错误

reason:  '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';

最后发现

(1)UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]这个方法有问题换成

(2)UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 问题解决;

看错误提示第一个方法须在storyboard或xib中初始化的时候使用或者自定义cell时,需要如下两个方法

- (void)registerNib:(UINib *)nib forCellReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(5_0); 
- (void)registerClass:(Class)cellClass forCellReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(6_0);
例如
[self.tableView registerClass:[MyTableviewCell class] forCellReuseIdentifier:@"MyCell"];
 

reason: 'unable to dequeue a cell with identifier Cell的更多相关文章

  1. UITableView错误 ‘unable to dequeue a cell with identifier Cell'

    - (id)dequeueReusableCellWithIdentifier:(NSString *)identifier; - (id)dequeueReusableCellWithIdentif ...

  2. unable to dequeue a cell with identifier MealTableViewCell

    1 问题描述 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable ...

  3. swift写一个简单的列表unable to dequeue a cell with identifier reuseIdentifier - must register a nib or a cla

    报错:unable to dequeue a cell with identifier reuseIdentifier - must register a nib or a class for the ...

  4. IOS-static cell 与 dynamic cell 混合使用

    static cell 与 dynamic cell 混合使用 关于静态cell与动态cell的混合使用,google一下便会有很多相关文章,这里也是看过一些前辈的经验(已经忘记具体是从哪篇文章得到的 ...

  5. 实现点击cell实现改变cell和cell上控件的背景颜色

    话不多少,贴上代码吧!!! // // ViewController.m // CellChangeBgColorDemo // // Created by 思 彭 on 17/1/12. // Co ...

  6. IOS第八天(7:UITableViewController新浪微博,cell 复用的简单写法优化和cell高度从模型中获取)

    *********** #import "HMViewController.h" #import "HMStatus.h" #import "HMSt ...

  7. iOS Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to

    刚接触iOS,依照教程操作执行出现错误 Terminating app due to uncaught exception 'NSInternalInconsistencyException', re ...

  8. tableview的两个重用cell方法

    今天在学习IAP的时候无意间看到原来  tableView: cellForRowAtIndexPath:方法中有两个获得重用cell的方法,一直以来都是用 UITableViewCell  *cel ...

  9. AJ学IOS(17)UI之纯代码自定义Cell实现新浪微博UI

    AJ分享,必须精品 先看效果图 编程思路 代码创建Cell的步骤 1> 创建自定义Cell,继承自UITableViewCell 2> 根据需求,确定控件,并定义属性 3> 用get ...

随机推荐

  1. C语言的指针变量

    C语言的指针变量 在C语言中,变量是固定范围的存储空间,它存储的是赋给他的值, 比如: ; /* 这里是定义一个整型变量a,并把12这个值存储在a的地址空间上 这个地址空间是系统随机分配的,对用户是透 ...

  2. 堆排序(java实现)

    public class Test04 { static int a[] = {9,8,7,6,5,4,3,2,1,11,12,10,19,18,17,16}; public static void ...

  3. 如何修改Protel99SE原理图的标题栏

    本文主要讲述了如何修改Protel99SE原理图中的标题栏内容,使用者可以根据需要修改. 标题栏的格式: 1.添加模板:(1)菜单栏Design\Template\Set Template File ...

  4. QT IP输入框正则表达式(使用QLineEdit的setValidator函数)

    /* ip输入框正则表达式 */ // IP 前3段 QRegExp regExp("[0-9][0-9.][0-9.][.]"); ui->lineEdit_1->s ...

  5. [置顶] MongoDB 分布式操作——分片操作

    MongoDB 分布式操作——分片操作 描述: 像其它分布式数据库一样,MongoDB同样支持分布式操作,且MongoDB将分布式已经集成到数据库中,其分布式体系如下图所示: 所谓的片,其实就是一个单 ...

  6. BZOJ 1739: [Usaco2005 mar]Space Elevator 太空电梯

    题目 1739: [Usaco2005 mar]Space Elevator 太空电梯 Time Limit: 5 Sec  Memory Limit: 64 MB Description The c ...

  7. MessageDigest简单介绍

    本文博客原文 參考文章:http://blog.sina.com.cn/s/blog_4f36423201000c1e.html 一.概述 java.security.MessageDigest类用于 ...

  8. 关于js闭包是否真的会造成内存泄漏(转载)

    闭包是一个非常强大的特性,但人们对其也有诸多无解.一种危言耸听的说法是闭包会造成内存泄露. 局部变量本来应该在函数退出的时候被解除引用,但如果局部变量被封闭在闭包形成的环境中,那么这个局部变量就能一直 ...

  9. Maven导入时,Cannot change version of project facet Dynamic Web Module to 3.0.

    今天手贱,在eclipse里面把项目删掉了,重新maven导入时,报出Cannot change version of project facet Dynamic Web Module to 3.0. ...

  10. javascript基础、语法

    JavaScript基础(简介.语法) 一.JavaScript简介 1.JavaScript是个什么东西? 它是个脚本语言,需要有宿主文件,它的宿主文件是HTML文件. 2.它与Java什么关系? ...