在将表视图设置为使用“动态原型”并将标识符设置为“ListPrototypeCell”之后,我添加了“cellForRowAtIndexPath”方法,但它崩溃并显示以下错误:
Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/CertUIFramework.axbundle> (未加载)
2014-08-10 13:35:50.519 ToDoList[8954:60b] *** 在 -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] 中的断言故障,/SourceCache/UIKit_Sim/UIKit-2935.137/UITableView.m:5439
2014-08-10 13:35:50.523 ToDoList[8954:60b] *** 终止应用程序,原因:无法使用标识符 ListPrototypeCell 获取可重用单元格 - 必须注册一个 Nib 或类来获取该标识符或在故事板中连接原型单元格'
. . . .
libc++abi.dylib: 以 NSException 类型终止未捕获的异常
我已经按照教程进行操作,但是找不到错误。有人可以建议我错在哪里吗?
代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ListPrototypeCell" forIndexPath:indexPath];
XYZToDoItem *toDoItem = [self.toDoItems objectAtIndex:indexPath.row];
cell.textLabel.text = toDoItem.itemName;
return cell;
}