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

iPhone Core Data Tutorial Parte 2

[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:

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