iphone - Xcode 4.2 "cell reuse indentifier in nib (Cell) does not match the identifier used to register the nib (ThisCell)"

标签 iphone ios xcode uitableview xcode4.2

我正在尝试使用 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/

相关文章:

iphone - UITableView 自定义单元格无法流畅滚动,因为数据库阻塞了我的主线程

iphone - 在 Xcode 4 中可视化我的代码

ios - 关于使用 Cocoapods 设置 OCMockito 的问题

ios - 在 Swift 的 UITextView 中包装文本

ios - 如何在 Swift 的 WKWebView 中禁用用户选择?

iOS 6 Facebook 发布程序以 "remote_app_id does not match stored id"结束

ios - Objective -C 回调不适用于不幸的后台崩溃

ios - 解析 Swift - 自定义登录警报 View 错误

iphone - Finder 窗口中的 Mac OS Lion 无法看到 iPhone Simulator 文件夹

ios - Swift:尝试导入 UIKit 时出错