这里是我的代码来删除值。当我重新启动我的应用程序,它会显示已删除的记录也表视图删除记录临时...UITableView不从NSUserDefaults删除记录
-(void)tableView:(UITableView *)atableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
[bookmarks removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationFade];
[[NSUserDefaults standardUserDefaults] setObject:bookmarks forKey:@"Bookmarks"]; [self.tableView reloadData];
}
}
请帮助。
你想只删除特定的值?或完整列表? – 2011-05-19 11:45:34
只有选定的值 – iProgrammer 2011-05-19 11:49:45
[[[NSUserDefaults standardUserDefaults] setObject:bookmarks forKey:@“Bookmarks”] synchronize];加上这个 – 2011-05-19 11:54:02