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 :)
try to use writeToFile: atomically:
method
精彩评论