Here is my code to delete value. Table view is deleting record temporary when I restart my app it will show deleted records also...
-(void)tableView:(UITableView *)atableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
[bookmarks removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITabl开发者_如何学JAVAeViewRowAnimationFade];
[[NSUserDefaults standardUserDefaults] setObject:bookmarks forKey:@"Bookmarks"]; [self.tableView reloadData];
}
}
Please Help.
Try this :
// Your code
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setObject:bookmarks forKey:@"Bookmarks"];
// saving it all
[prefs synchronize];
精彩评论