*   >> Lectura Educación Artículos >> science >> programación

iPhone Core Data Tutorial Parte 3,2

itWithRootViewController: addIngredientView];

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

[liberación addIngredientView];

[liberación NavController];

}

- (void) {didReceiveMemoryWarning

//Libera la vista si no tiene un supervista

[súper didReceiveMemoryWarning];

/. /Suelte los datos almacenados en caché, imágenes, etc., que no están en uso

}

-. (void) {viewDidUnload

//liberar cualquier subvistas del principal retenido vista.


//por ejemplo, self.myOutlet = nil;

}

métodos vista pragma marca Tabla

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

retorno [[fetchedResultsController secciones] cuentan];

}

- (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) sección {

Identificación del sectionInfo = [[ ,,,0],secciones fetchedResultsController] objectAtIndex: sección];

retorno [sectionInfo numberofobjects];

}

//Personaliza la apariencia de las células vista de tabla

-.

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

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

* UITableViewCell celular = [tableView dequeueReusableCellWithIdentifier: CellIdentifier ];

si (celular == nil) {

celular = [[[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifier] autorelease];

}

//Configurar la célula

Ingrediente * ingrediente = [fetchedResultsController objectAtIndexPath: indexPath];.

cell.textLabel.

text = ingredient.ingredientName;

celular retorno ;

}

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

[tableView deselectRowAtIndexPath: indexPath animado: YES];

}

//Ignorar para apoyar la edición de la vista de tabla

- (void) tableView:.

(UITableView *) tableView commitEditingStyle: (UITableViewCellEditingStyle) editingStyle forRowAtIndexPath: (NSIndexPath * ) indexPath {

si (editingStyle == UITableViewCellEditingStyleDelete) {

//Eliminar el objeto gestionado por el camino índice dado

NSManagedObjectContext * context = [fetchedResultsController managedObjectContext];

[contexto deleteObje

Page   <<  [1] [2] [3] [4] [5] >>
Copyright © 2008 - 2016 Lectura Educación Artículos,https://lectura.nmjjxx.com All rights reserved.