Lion
Lion

Reputation: 872

How to delete a row of plist programmatically?

Can anyone help me to delete row of plist.

here dictValue is NSNumber, dict is NSDictionary, keys is NSMutableArray and mutDict is NSMutableDictionary.

if (editingStyle == UITableViewCellEditingStyleDelete) {
        dictValue = [dict objectForKey:[keys objectAtIndex:indexPath.row]];
        NSLog(@"Row Number - value %d", [dictValue intValue]);
        mutDict = [[NSMutableDictionary alloc] initWithContentsOfFile:[self doccuments_Path]];

        [mutDict removeObjectForKey:[keys objectAtIndex:indexPath.row]];

        //[keys removeObjectAtIndex:indexPath.row];
        [tableView reloadData];
        // Delete the row from the data source.
        //[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }   

Any help would be extremely appreciated :)

Upvotes: 1

Views: 1521

Answers (1)

Vaibhav Tekam
Vaibhav Tekam

Reputation: 2344

try to use writeToFile: atomically:method

Upvotes: 2

Related Questions