*   >> Lecture Éducation Articles >> science >> la programmation

iPhone de base de données Tutorial Part 2

ementation PhotoViewController

Recettes desynthesize, IMAGEVIEW;

- (void) {viewDidLoad

[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];

[recettes de presse];

[imageView presse];

}

end

Enregistrer cela et ouvrir AddRecipeViewController.h et ajouter un photoButton UIButton nommé et une méthode IBAction lorsque le bouton est cliqué

interface AddRecipeViewController:.

UIViewController {

* Recettes recettes;

* UITextField textFieldOne;

* UITextField textFieldTwo;

* UIButton photoButton;

}

(property, conservent nonatomic) Recettes * recettes;

property (nonatomic, conserver) IBOutletUITextField * textFieldOne;

property (nonatomic, conserver) IBOutletUITextField * textFieldTwo;

property (nonatomic, conserver) IBOutletUIButton * photoButton;

- (IBAction) photoButtonPressed;

< p>end

Ouvrez le fichier .m et écrire:

import

"AddRecipeViewController.

h"

#import "Recipes.h"

import

"PhotoViewController.h"

implementation AddRecipeViewController

synthesize recettes, textFieldOne, textFieldTwo, photoButton;

- (void) {

viewDidLoad

[superviewDidLoad];

self.title = @ "Ajouter recette";

* UIBarButtonItem cancelButton = [[UIBarButtonItemalloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCanceltarget:selfaction:@selector(cancel)];

self.navigationItem.

leftBarButtonItem = CancelButton;

[communiqué cancelButton];

* UIBarButtonItem saveButton = [[UIBarButtonItemalloc] initWithTitle:@"Save"style:UIBarButtonItemStyleDonetarget:selfaction:@selector(save)];

self.navigationItem.rightBarButtonItem = SaveButton;

[libération saveButton];

[photoButtons

Page   <<  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] >>
Copyright © 2008 - 2016 Lecture Éducation Articles,https://lecture.nmjjxx.com All rights reserved.