Xcode 4.2 “cell reuse indentifier in nib (Cell) does not match the identifier used to register the nib (ThisCell)”

泄露秘密 提交于 2019-12-07 04:01:14

问题


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.

cell reuse indentifier in nib (Cell) does not match the identifier used to register the nib (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;

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.

Thanks


回答1:


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.




回答2:


Take a look at following 2 places in your project. And make sure they both string identifiers are same.



来源:https://stackoverflow.com/questions/7797052/xcode-4-2-cell-reuse-indentifier-in-nib-cell-does-not-match-the-identifier-us

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!