}
- (void) viewWillAppear: (BOOL) animée {
[superviewWillAppear: animation];
[photoButtonsetImage: recipes.recipeThumbnailImage forState: UIControlStateNormal];
}
- (void ) {annuler
[recipes.managedObjectContextdeleteObject: les recettes];
NSError * error = nul;
Si ([recipes.
managedObjectContextsave: & error]!) {
//erreur de poignée
NSLog (@ "non résolus erreur% @,% @", erreur [Erreur userInfo]);
exit (-1); //Fail
}
[selfdismissModalViewControllerAnimated: OUI];
}
- (void) {sauver
recipes.recipeName = textFieldOne.text;
recipes.cookingTime = textFieldTwo.text;
NSError * error = nul;
Si ([recipes.
managedObjectContextsave: & error]!) {
//Poignée erreur
NSLog (@ "non résolus erreur% @,% @", erreur [Erreur userInfo]);
exit (-1); //Fail
}
[selfdismissModalViewControllerAnimated: OUI];
}
- (void) {didReceiveMemoryWarning
[superdidReceiveMemoryWarning] ;
}
- (void) {viewDidUnload
}
#pragma mark -
#pragma Photo Mark
- (IBAction) photoButtonPressed {
[textFieldOne endEditing: OUI];
[textFieldTwo endEditing: OUI];
* imagePicker UIImagePickerController = [[UIImagePickerControlleralloc] initialisation ];
imagePicker.
delegate = auto;
[selfpresentModalViewController: imagePicker animé: OUI]; [imagePicker presse];
}
- (void ) imagePickerController: (UIImagePickerController *) Préparateur didFinishPickingImage: (UIImage *) SelectedImage editingInfo: (NSDictionary *) editingInfo {
* NSManagedObject oldImage = recipes.recipeImage;
Si (oldImage = nil) {
[recipes.managedObjectContextdeleteObject: oldImage];
}
* RecipeImage image = [NSEntityDescriptioninsertNewObjectForEntityForName:@"RecipeImage"inManagedObjectContext:recipes.
managedObjectContext];
recipes.recipeImage = Image;
[image setValue: SelectedImage forKey: @ "recipeImage"];
Taille CGSize = selectedImage.size;
CGFloat rapport = 0;
< p> if (size.width> size.height) {
rapport = 128,0 /size.width;
} else {
rapport = 130,0 /size.height;
}
CGRect rect = CGRectMake (0.0, 0.0, le rapport