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 dequeue开发者_JAVA百科ReusableCellWithIdentifier:@"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
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.
Take a look at following 2 places in your project. And make sure they both string identifiers are same.
The problem is as @Duncan Babbage described. It happens when there is some type of conflicts in the reuse identifier for the same instance. (In my case, I defined two different reuse identifiers in both Storyboard and code and they were conflicting each other )
- you can also look for "Cell" outside the .xib file, specifically in all project files.
精彩评论