Din*_*sh_ 3 iphone uitableview ios4 ios
我想从tableView中删除选定的行.我想为用户提供在他滑动或轻弹手指时删除行的功能.我知道编辑样式,它提供了一个带有-ve标志的圆形红色按钮.
我试过这段代码:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView beginUpdates];
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Do whatever data deletion you need to do...
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationTop];
}
[tableView endUpdates];
[tableView reloadData];
}
Run Code Online (Sandbox Code Playgroud)
我得到删除按钮,但当我点击它SIGABRT错误就在那里.
Vis*_*hal 17
尝试以下行:
[bookmarks removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationFade];
Run Code Online (Sandbox Code Playgroud)
书签是我在表视图单元格上加载的数组名称,您应该使用数组名称来代替此.
| 归档时间: |
|
| 查看次数: |
21675 次 |
| 最近记录: |