我正在尝试使用 Xcode 4.2 的新 StoryBoard 功能,但在使用带有自定义单元格的 TableView 时不断出现此错误。
nib (Cell) 中的单元重用标识符与用于注册 nib (ThisCell) 的标识符不匹配
我已将我的自定义单元格的类设置为我的自定义 UITableViewCell 类,并在 IB 中将标识符设置为“ThisCell”。
- (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”是从哪里来的。有任何想法吗?我尝试在另一个项目中加载一个自定义单元格,它似乎工作正常,我只是找不到关于这个错误的任何文档来找出我在当前项目中搞砸了什么。
谢谢
最佳答案
错误消息指出,在您的 nib 中,单元格被标识为“单元格”——您需要查看定义自定义单元格的 xib 文件以配置单元格重用标识符,并将其设置为 ThisCell... 或者只需在此代码中将 ThisCell 更改为 Cell。
关于iphone - Xcode 4.2 "cell reuse indentifier in nib (Cell) does not match the identifier used to register the nib (ThisCell)",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7797052/