我想从我的表视图中删除单元格,但它显示例外:异常而删除细胞
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[RootViewController aBook]: unrecognized selector sent to instance 0x3d217a0'
这里是我的代码:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { NSLog(@"handover values to object"); Book *aBook = [appDelegate.books objectAtIndex:indexPath.row]; NSLog(@"removing"); [[self aBook] removeObjectAtIndex:[indexPath row]]; NSLog(@"deleting row"); // Animate deletion NSArray *indexPaths = [NSArray arrayWithObject:indexPath]; [[self tableView] deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade]; }
控制显示在印刷后的8号线除外“删除”一词。也给出了警告,“根视图控制器不响应aBook” 帮助!
不工作仍然给予相同的例外! – Ketan 2011-04-05 12:28:27