Sea*_*ean 2 iphone crash row uitableview
我只是尝试UITableView使用以下代码从a中删除一行:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
Run Code Online (Sandbox Code Playgroud)
问题是我的应用程序崩溃了.(GDB:程序收到信号:"EXC_BAD_INSTRUCTION".)有人知道为什么吗?
您可能需要更改返回的数字
- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section
Run Code Online (Sandbox Code Playgroud)
因为它indexPath.section比删除前低一个.
| 归档时间: |
|
| 查看次数: |
6412 次 |
| 最近记录: |