Today's Menu  Portugal
journal and plan nutrition
Instance Methods | Properties | List of all members
Y3RecipeCheckViewController Class Reference

#import <Y3RecipeCheckViewController.h>

Inheritance diagram for Y3RecipeCheckViewController:
Inheritance graph
[legend]
Collaboration diagram for Y3RecipeCheckViewController:
Collaboration graph
[legend]

Instance Methods

(id) - initWithMenuItem:
 
(void) - viewDidLoad [implementation]
 
(void) - viewWillAppear: [implementation]
 
(void) - viewWillDisappear: [implementation]
 
(void) - fireParameterEntry [implementation]
 
(void) - didReceiveMemoryWarning [implementation]
 

Properties

MenuItemfocusMenuItem [implementation]
 

Detailed Description

Definition at line 12 of file Y3RecipeCheckViewController.h.

Method Documentation

◆ didReceiveMemoryWarning()

- (void) didReceiveMemoryWarning
implementation

Definition at line 102 of file Y3RecipeCheckViewController.m.

102  {
103  [super didReceiveMemoryWarning];
104  // Dispose of any resources that can be recreated.
105 }

◆ fireParameterEntry()

- (void) fireParameterEntry
implementation

Definition at line 86 of file Y3RecipeCheckViewController.m.

87 {
88  if (nil != self.focusMenuItem) {
89  self.focusMenuItem.recipe = recipeViewTextView.text;
90  self.focusMenuItem.usdaNumbers = usdaDataViewTextView.text;
91 
92  NSLog(@"CollectionView.fireParameterEntry: focusMenuItem: %@", self.focusMenuItem);
93 
94  Y4UsdaParamEntryViewController *parameterView =
95  [[Y4UsdaParamEntryViewController alloc] initWithMenuItem:[self focusMenuItem]];
96  [self.navigationController pushViewController:parameterView animated:YES];
97  } else {
98  NSLog(@"CollectionView.fireParameterEntry: nil focusMenuItem");
99  }
100 }
UITextView * usdaDataViewTextView
UITextView * recipeViewTextView

◆ initWithMenuItem:()

- (id) initWithMenuItem: (MenuItem *)  menuItem

Definition at line 23 of file Y3RecipeCheckViewController.m.

23  :(MenuItem *)menuItem
24 {
25  self = [super init];
26  self.focusMenuItem = menuItem;
27  return self;
28 }
MenuItem * menuItem

◆ viewDidLoad()

- (void) viewDidLoad
implementation

Definition at line 30 of file Y3RecipeCheckViewController.m.

30  {
31  [super viewDidLoad];
32  // Do any additional setup after loading the view.
33  CGRect totalFrame = self.view.frame;
34  [self.view setBackgroundColor:[UIColor greenColor]];
35 
36  CGRect recipeViewFrame = CGRectMake(totalFrame.size.width*0.05,
37  totalFrame.origin.y+totalFrame.size.height*0.180,
38  totalFrame.size.width*0.9,
39  220.0);
40  recipeViewTextView = [[UITextView alloc] initWithFrame:recipeViewFrame];
41  [recipeViewTextView setBackgroundColor:[UIColor whiteColor]];
42  [self.view addSubview:recipeViewTextView];
43 
44  CGRect usdaDataViewFrame = CGRectMake(totalFrame.size.width*0.05,
45  totalFrame.origin.y+totalFrame.size.height*0.180 + 240,
46  totalFrame.size.width*0.9,
47  220.0);
48  usdaDataViewTextView = [[UITextView alloc] initWithFrame:usdaDataViewFrame];
49  [usdaDataViewTextView setBackgroundColor:[UIColor yellowColor]];
50  [self.view addSubview:usdaDataViewTextView];
51 
52  UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Entry" style:UIBarButtonItemStylePlain target:self action:@selector(fireParameterEntry)];
53  self.navigationItem.rightBarButtonItem = anotherButton;
54 }
UITextView * usdaDataViewTextView
UITextView * recipeViewTextView

◆ viewWillAppear:()

- (void) viewWillAppear: (BOOL)  animated
implementation

Definition at line 56 of file Y3RecipeCheckViewController.m.

56  :(BOOL)animated
57 {
58  [recipeViewTextView setText:[self.focusMenuItem recipe]];
59  [usdaDataViewTextView setText:[self.focusMenuItem usdaNumbers]];
60 }

◆ viewWillDisappear:()

- (void) viewWillDisappear: (BOOL)  animated
implementation

Definition at line 62 of file Y3RecipeCheckViewController.m.

62  :(BOOL)animated
63 {
64  [super viewWillDisappear:animated];
65 
66  // NSString *newStr = [m5mo bodytext];
67  // NSData* data = [newStr dataUsingEncoding:NSUTF8StringEncoding];
68  //
69  [[[Z5DataController sharedInstance] localDataController] saveContext];
70  NSLog(@"RecipeCheckController.viewWillDisappear: usdaNumbers: %@", [self.focusMenuItem usdaNumbers]);
71 
72  NSError *error;
73  NSData *data = [[self.focusMenuItem usdaNumbers] dataUsingEncoding:NSUTF8StringEncoding];
74  if (data) {
75  NSDictionary *jsonResponse = [NSJSONSerialization JSONObjectWithData:data
76  options:kNilOptions
77  error:&error];
78  if (error) {
79  NSLog(@"RecipeCheckController.viewWillDisappear: error: %@", error);
80  } else {
81  NSLog(@"RecipeCheckController.viewWillDisappear: jsonResponse: %@", jsonResponse);
82  }
83  }
84 }
instancetype sharedInstance()
Singleton interface to both core and remote data sources.

Property Documentation

◆ focusMenuItem

- (MenuItem*) focusMenuItem
readwritenonatomicstrongimplementation

Definition at line 15 of file Y3RecipeCheckViewController.m.


The documentation for this class was generated from the following files: