objective-C : Reset tableview loaded with feltching objects (core data)

Posted by the1nz4ne on Stack Overflow See other posts from Stack Overflow or by the1nz4ne
Published on 2010-03-22T14:34:22Z Indexed on 2010/03/23 19:33 UTC
Read the original article Hit count: 375

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about core-data

Related posts about objects