*   >> Leitura Educação Artigos >> science >> programação

iPhone Core Data Tutorial Parte 1

}

#pragma mark -

marca #pragma Adicionar um novo objeto

- (void) {addRecipe

AddRecipeViewController * addRecipeView = [[AddRecipeViewController alloc] initWithNibName: @ "AddRecipeViewController "bundle: [NSBundle mainBundle]];

* Receitas Receitas = (Receitas *) [NSEntityDescription insertNewObjectForEntityForName: @" receitas "inManagedObjectContext: self.managedObjectContext];

addRecipeView.

recipes = receitas;

UINavigationController * NavController = [[UINavigationController alloc] initWithRootViewController: addRecipeView];

[self.navigationController presentModalViewController: NavController animado: YES];

[liberação addRecipeView];

}

#pragma mark -

#pragma mark Tabela métodos vista

- (NSInteger) numberOfSectionsInTableView: (UITableView *) tableView {

< p> retorno [[fetchedResultsController seções] count];

}

- (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) section {

ID de sectionInfo = [[fetchedResultsController seções] objectAtIndex: seção];

retorno [sectionInfo numberOfObjects];

}

- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {

NSString estática * CellIdentifier = @ "Cell";

UITableViewCell * célula = [tableView dequeueReusableCellWithIdentifier: CellIdentifier];

if (celular == nil) {

célula = [alloc [[UITableViewCell] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifier] autorelease];

}

NSManagedObject * managedObject = [fetchedResultsController objectAtIndexPath: indexPath] ;

cell.

textLabel.text = [[managedObject valueForKey: @ "recipeName"] descrição];

célula de retorno;

}

- ( void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath {

RecipeDetailViewController * recipeDetailView = [[RecipeDetailViewController alloc] initWithStyle: UITableViewStyleGrouped];

* Receitas Receitas = (Receitas * ) [fetchedResultsController objectAtIndexPath: indexPath];

recipeDetailView.recipes = receitas;

[self.

navigationController pushViewController: recipeDetailView animado: YES];

}

- (void) tableView: (UITableView *) tableView commitEditingStyle: (UITableViewCellEditingStyle) editingStyle forRowAtIndexPa

Page   <<  [1] [2] [3] [4] [5] [6] [7] >>
Copyright © 2008 - 2016 Leitura Educação Artigos,https://artigos.nmjjxx.com All rights reserved.