views:

250

answers:

1

hi, i have a tableview application loaded with core data feltching objects and i wanna know if it is possible to reset the table with a simple button. Thanks

code to add an object :

    NSManagedObjectContext *context = [fetchedResultsController managedObjectContext];
NSEntityDescription *entity = [[fetchedResultsController fetchRequest] entity];
NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context];




[newManagedObject setValue:string forKey:@"timeStamp"];

my code to delete (one) object:

    NSManagedObjectContext *context = [fetchedResultsController managedObjectContext];
    [context deleteObject:[fetchedResultsController objectAtIndexPath:indexPath]];

i want a button that reset the tableview and delete everything thanks

A: 

Change the datasource to an empty one, and use the reloadData method to reload the table data from that datasource?

Björn
but what is my data source? im using feltching objects i don't know how to put the datasource to empty.
the1nz4ne
any answer ????
the1nz4ne