【发布时间】:2013-01-09 11:59:36
【问题描述】:
我知道以前在 SO 上已经问过这类问题,我几乎尝试了所有这些问题,但都无济于事。我正在尝试从 UITableView 中删除一行。这是我的代码。
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
//calls to a method that deletes the row from the backend SQLite database
[self deleteCompany:indexPath.row];
//theCompanies is a NSMutableArray. When the app starts, it retrieves the data and display it in the UITableView
[theCompanies removeObjectAtIndex:indexPath.row];
//Below line is where the error occurs.
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:YES
UITableViewRowAnimationFade:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
}
}
我在构建应用程序时收到以下编译器错误。
“UITableView”没有可见的@interface 声明选择器...
我不知道接下来我应该做什么。任何帮助将不胜感激。
谢谢。
【问题讨论】:
-
错误消息的下一部分是什么。你遗漏了重要的部分:-)
-
你为什么不顺便阅读一下文档呢?此外,这太基础了——你甚至不知道调用方法的正确语法。
-
@H2CO3 我假设你是反对者。也许它对你来说太基础了。但我几周前才开始 iOS 开发。
标签: ios uitableview ios5 delete-row