Kil*_*Ice 8 iphone uitableview ios
如何在滑动时删除UITableView行?我知道问题已被提出,但我只得到错误.这是代码:
-(void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath {
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath {
// If row is deleted, remove it from the list.
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSInteger row = [indexPath row];
[tableDataSource removeObjectAtIndex:row];
}
}
Run Code Online (Sandbox Code Playgroud)
但没有任何反应.如果你编写代码,我将不胜感激.
Ben*_*oît 45
更好的是删除所选行,而不是重新加载所有表:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8855 次 |
| 最近记录: |