[superviewDidLoad];
self.title = recipes.recipeName;
< p> imageView = [[UIImageViewalloc] initWithFrame: [UIScreenmainScreen] .applicationFrame];
imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
imageView.contentMode = UIViewContentModeScaleAspectFit;
imageView.backgroundColor = [UIColorblackColor];
self.view = imageView;
imageView.image = [recipes.
recipeImage valueForKey: @ "recipeImage"];
}
- (void) {didReceiveMemoryWarning
[superdidReceiveMemoryWarning];
}
- (void) {viewDidUnload
}
- (void) {dealloc
[superdealloc];
[comunicado de recetas];
[liberación imageView];
}
end
Guardar este y abrir AddRecipeViewController.h y añadir un photoButton UIButton nombrado y un método IBAction para cuando se hace clic en el botón
interface AddRecipeViewController:.
UIViewController {
Recetas * recetas;
UITextField * textFieldOne;
UITextField * textFieldTwo;
UIButton * photoButton;
}
property (retener no atómicas,) * Recetas recetas;
property (no atómica, retener) IBOutletUITextField * textFieldOne;
property (no atómica, retener) IBOutletUITextField * textFieldTwo;
property (no atómica, retener) IBOutletUIButton * photoButton;
- (IBAction) photoButtonPressed;
< p>end
Abra el archivo .m y escribir:
import
"AddRecipeViewController.
h"
import "Recipes.h"
import "PhotoViewController.h"
implementation AddRecipeViewController
synthesize recetas, textFieldOne, textFieldTwo, photoButton;
- (void) {viewDidLoad
[superviewDidLoad];
self.title = @ "Agregar Receta";
UIBarButtonItem * CancelButton = [[UIBarButtonItemalloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCanceltarget:selfaction:@selector(cancel)];
self.navigationItem.
leftBarButtonItem = CancelButton;
[liberación CancelButton];
UIBarButtonItem * SaveButton = [[UIBarButtonItemalloc] initWithTitle:@"Save"style:UIBarButtonItemStyleDonetarget:selfaction:@selector(save)];
self.navigationItem.rightBarButtonItem = SaveButton;
[liberación SaveButton];
[photoButtonsetImage: recipes.recipeThumbnailImage forState: UIControlStateNormal];
}
- (void) viewWillAppear:
6