[addRecipeView vrijlating];
}
#pragma mark -
#pragma merk Table view methoden
- (NSInteger) numberOfSectionsInTableView: (UITableView *) TableView {
< p> Terug [[fetchedResultsController artikelen] tel];
}
- (NSInteger) tableView: (UITableView *) TableView numberOfRowsInSection: (NSInteger) section {
id sectionInfo = [[fetchedResultsController artikelen] objectAtIndex: sectie];
return [sectionInfo numberOfObjects];
}
- (UITableViewCell *) tableView: (UITableView *) TableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {
statische NSString * CellIdentifier = @ "Cell";
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier];
als (cel == nihil) {
cel = [[[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifier] autorelease];
}
NSManagedObject * managedObject = [fetchedResultsController objectAtIndexPath: indexPath] ;
cell.
textLabel.text = [[managedObject valueForKey: @ "recipeName"] beschrijving];
return cel;
}
- ( void) tableView: (UITableView *) TableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath {
RecipeDetailViewController * recipeDetailView = [[RecipeDetailViewController alloc] initWithStyle: UITableViewStyleGrouped];
Recepten * recepten = (Recipes * ) [fetchedResultsController objectAtIndexPath: indexPath];
recipeDetailView.recipes = recepten;
[self.
navigationController pushViewController: recipeDetailView geanimeerd: JA];
}
- (void) tableView: (UITableView *) TableView commitEditingStyle: (UITableViewCellEditingStyle) editingStyle forRowAtIndexPath: (NSIndexPath *) indexPath {
als (editingStyle == UITableViewCellEditingStyleDelete) {
NSManagedObjectContext * context = [fetchedResultsController managedObjectContext];
[context DeleteObject: [fetchedResultsController objectAtIndexPath: indexPath]];
NSError * error = nil;
als ([context save! & error; ]) {
NSLog (@ "Onopgeloste fout% @,% @", fout, [fout UserInfo]);
af te breken ();
}
}
}
#pragma mark -
#pragma merk Fetched resultaten controller
- (NSFetchedResultsController *) fetchedResultsController {
< p> if (! fetchedResultsController = nihil) {
terugkeren fetchedResultsController;
}.
/*
Stel de opgehaalde resultaten controller
* /
//Maak de fetch verzoek om de entiteit
NSFetchRequest * fetchRequest = [[NSFetchRequest all