从uitableview中删除行 [英] Delete row from uitableview crashes
本文介绍了从uitableview中删除行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是尝试使用以下代码从 UITableView
中删除一行:
I simply try to delete a row from a UITableView
with the following code:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
问题是我的应用程序崩溃了。 (GDB:Program received signal:EXC_BAD_INSTRUCTION。)
任何人都知道为什么?
The problem is that my app crashes. (GDB: Program received signal: "EXC_BAD_INSTRUCTION".) Anybody know why?
推荐答案
返回的数字
- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section
为 indexPath.section
。
这篇关于从uitableview中删除行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文