Xcode 4.2“nib(Cell)中的单元重用标识符与用于注册nib(ThisCell)的标识符不匹配” [英] Xcode 4.2 "cell reuse indentifier in nib (Cell) does not match the identifier used to register the nib (ThisCell)"

查看:121
本文介绍了Xcode 4.2“nib(Cell)中的单元重用标识符与用于注册nib(ThisCell)的标识符不匹配”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Xcode 4.2的新StoryBoard功能,并在使用自定义单元格的表视图时不断出现此错误。

I'm trying to use the new StoryBoard feature of Xcode 4.2 and keep getting this error when using a Table View with a custom cell.

nib(Cell)中的单元重用标识符与用于注册nib的标识符(ThisCell)不匹配

我已设置我的自定义单元格的类到我的自定义UITableViewCell类,并在IB中将标识符设置为ThisCell。

I've set the class of my custom cell to my custom UITableViewCell class and set the Identifier to "ThisCell" in IB.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {     
static NSString *CellIdentifier = @"ThisCell";
//TableViewCell *cell = (TableViewCell*)[tableView dequeueReusableCellWithIdentifier:@"ThisCell"];
TableViewCell *cell = (TableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
return cell;

我不知道Cell来自哪里。有任何想法吗?我尝试在另一个项目中加载一个自定义单元格,它似乎工作正常,我只是找不到任何关于此错误的文档,以找出我在当前项目中搞砸了什么。

I have no idea where "Cell" is coming from. Any ideas? I tried loading a custom cell in another project, and it seems to work fine, I just can't find any documentation on this error to find out what I messed up in the current project.

谢谢

推荐答案

错误消息指出您的笔尖中的单元格被标识为单元格 - 您需要查看定义用于配置Cell Reuse Identifier的自定义单元格的xib文件,并将其设置为ThisCell ...或者只需在此代码中将ThisCell更改为Cell。

The error message states that in your nib the cell is identified as "Cell"—you need to look in the xib file that defines your custom cells for configuration of the Cell Reuse Identifier, and set that to ThisCell... Or just change ThisCell to Cell in this code.

这篇关于Xcode 4.2“nib(Cell)中的单元重用标识符与用于注册nib(ThisCell)的标识符不匹配”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆