unable to dequeue a cell with identifier xxx - must register a nib or a class fo

问题如下:

最近自定义Cell 出现不少问题,一般都是由于没有进行注册 
下面是我遇到的,写的基本上同样的自定义Cell这个运行就报下面的错误。

解决方法:

方法一:

将方法

dequeueReusableCellWithIdentifier: forIndexPath:
1
替换成方法

dequeueReusableCellWithIdentifier:
1
方法二:

在方法

dequeueReusableCellWithIdentifier: forIndexPath:的前面添加方法

[self.tableView registerClass:[UITableViewCell class]    forCellReuseIdentifier:reuseIdentifier];

如果是自定义cell的话,若类名为 xxxxcill,那么添加的方法将改为

[self.tableView registerClass:[xxxxcell class] forCellReuseIdentifier:reuseIdentifier];
 

猜你喜欢

转载自blog.csdn.net/ios_xumin/article/details/123994426