【发布时间】:2011-07-29 22:12:22
【问题描述】:
我正在尝试从我的表格视图中删除一个单元格,但它显示异常:
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“*** -[RootViewController aBook]:无法识别的选择器发送到实例 0x3d217a0”这是我的代码:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { NSLog(@"将值移交给对象"); Book *aBook = [appDelegate.books objectAtIndex:indexPath.row]; NSLog(@"删除"); [[self aBook] removeObjectAtIndex:[indexPath row]]; NSLog(@"删除行"); // 动画删除 NSArray *indexPaths = [NSArray arrayWithObject:indexPath]; [[self tableView] deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade]; }控件在打印“removing”字样后在第 8 行显示异常。还警告“根视图控制器没有响应 aBook” 帮助!!
【问题讨论】:
标签: iphone cocoa-touch