Oppskrifter * oppskrifter = (Oppskrifter *) [NSEntityDescription insertNewObjectForEntityForName: @" oppskrifter "inManagedObjectContext: self.managedObjectContext];
addRecipeView.recipes = oppskrifter;
UINavigationController * navController = [[UINavigationController alloc] initWithRootViewController: addRecipeView];
[self.
navigationController presentModalViewController: navController animerte: YES];
[addRecipeView utgivelsen];
}
#pragma mark -
#pragma mark tabellvisning metoder
- (NSInteger) numberOfSectionsInTableView: (UITableView *) Tableview {
< p> Retur [[fetchedResultsController seksjoner] telle];
}
- (NSInteger) Tableview: (UITableView *) Tableview numberOfRowsInSection: (NSInteger) section {
id sectionInfo = [[fetchedResultsController seksjoner] objectAtIndex: seksjonen];
retur [sectionInfo numberOfObjects];
}
- (UITableViewCell *) Tableview: (UITableView *) Tableview cellForRowAtIndexPath: (NSIndexPath *) indexPath {
statisk NSString * CellIdentifier = @ "Cell";
UITableViewCell * celle = [Tableview dequeueReusableCellWithIdentifier: CellIdentifier];
if (celle == null) {
celle = [[[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifier] autorelease];
}
NSManagedObject * managedObject = [fetchedResultsController objectAtIndexPath: indexPath] ;
cell.
textLabel.text = [[managedObject valueForKey: @ "recipeName"] beskrivelse];
retur celle;
}
- ( void) Tableview: (UITableView *) Tableview didSelectRowAtIndexPath: (NSIndexPath *) indexPath {
RecipeDetailViewController * recipeDetailView = [[RecipeDetailViewController alloc] initWithStyle: UITableViewStyleGrouped];
Oppskrifter * oppskrifter = (Oppskrifter * ) [fetchedResultsController objectAtIndexPath: indexPath];
recipeDetailView.recipes = oppskrifter;
[self.
navigationController pushViewController: recipeDetailView animerte: YES];
}
- (void) Tableview: (UITableView *) Tableview commitEditingStyle: (UITableViewCellEditingStyle) editingStyle forRowAtIndexPath: (NSIndexPath *) indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSManagedObjectContext * sammenheng = [fetchedResultsController managedObjectContext];
[sammenheng deleteObject: [fetchedRes