我只是尝试使用以下代码从 UITableView
中删除一行:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
问题是我的应用程序崩溃了。 (GDB:程序接收信号:“EXC_BAD_INSTRUCTION”。) 有人知道为什么吗?
最佳答案
您可能需要更改返回的数字
- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section
使 indexPath.section
比删除之前小 1。
关于iphone - 从 uitableview 崩溃中删除行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2229626/