cell.detailTextLabel.text = recipes.cookingTime;
pausa ;
padrão:
break;
}
célula de retorno;
}
- (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath {
if (self.editing) {
EditingViewController * editingview = [[EditingViewControlleralloc] initWithNibName: @ pacote "EditingViewController": [NSBundlemainBundle]];
editingview.recipes = receitas;
[self.
navigationControllerpushViewController: editingview animado: YES];
[liberação editingview];
}
{
[tableView deselectRowAtIndexPath: indexPath animado: YES];
}
}
- (UITableViewCellEditingStyle) tableView: (UITableView *) tableView editingStyleForRowAtIndexPath: (NSIndexPath *) indexPath {
returnUITableViewCellEditingStyleNone;
}
- (BOOL) tableView: (UITableView *) tableView shouldIndentWhileEditingRowAtIndexPath :( NSIndexPath *) indexPath {
returnNO;
}
marca #pragma -
#pragma mark Foto
- (IBAction) photoButtonPressed {
if (self.
editing) {
UIImagePickerController * imagePicker = [[UIImagePickerControlleralloc] o init];
imagePicker.delegate = auto;
[selfpresentModalViewController: imagePicker animado: YES];
[liberação imagePicker];
}
else {
PhotoViewController * photoview = [[PhotoViewControlleralloc] de init ];
photoView.recipes = receitas;
[self.
navigationControllerpushViewController: photoview animado: YES];
[liberação photoview];
}
}
- (void) imagePickerController: (UIImagePickerController *) selecionador didFinishPickingImage: (UIImage *) SelectedImage editingInfo: (NSDictionary *) editingInfo {
NSManagedObject * oldimage = receitas. recipeImage;
if (oldimage = nil!) {
[recipes.managedObjectContextdeleteObject: oldimage];
}
* RecipeImage imagem = [NSEntityDescriptioninsertNewObjectForEntityForName:@"RecipeImage"inManagedObjectContext:recipes.
managedObjectContext];
recipes.recipeImage = Imagem;
[imagem setValue: SelectedImage forKey: @ "recipeImage"];
CGSize size = selectedImage.size;
CGFloat ratio = 0;
< p> if (size.width> size.height) {
ratio = 128,0 /size.width;
} else {
ratio = 130,0 /size.height;