Today's Menu  Portugal
journal and plan nutrition
Instance Methods | Protected Attributes | List of all members
ZCMNutritionRootViewController Class Reference

#import <ZCMNutritionRootViewController.h>

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

Instance Methods

(id) - init [implementation]
 
(void) - viewDidLoad [implementation]
 
(void) - viewDidAppear: [implementation]
 
(void) - viewWillDisappear: [implementation]
 
(void) - deviceOrientationDidChange: [implementation]
 
(void) - orientLoadUI [implementation]
 
(void) - orientAppearUI [implementation]
 
(void) - viewDidLoadPortrait [implementation]
 
(void) - viewDidLoadLandscape [implementation]
 
(void) - viewDidAppearPortrait [implementation]
 
(void) - viewDidAppearLandscape [implementation]
 
(void) - positionFramesPortrait [implementation]
 
(void) - positionFramesLandscape [implementation]
 
(void) - createFiveButtons [implementation]
 
(void) - signedIn: [implementation]
 
(void) - signedOut: [implementation]
 
(void) - placeLogoutButton [implementation]
 
(void) - goToMenuScreen [implementation]
 
(void) - goToSnapMealScreen [implementation]
 
(void) - goToTimelineScreen [implementation]
 
(void) - goToOriginateScreen [implementation]
 
(void) - goToEditorScreen [implementation]
 
(void) - goToHealthKitScreen [implementation]
 
(void) - reviewComplete [implementation]
 
(void) - toggleAppleHealthKit [implementation]
 
(void) - imagePickerController:didFinishPickingMediaWithInfo: [implementation]
 
(void) - returnFromEntryReviewWithInfo:withCaption: [implementation]
 
(void) - imagePickerControllerDidCancel: [implementation]
 
(void) - didReceiveMemoryWarning [implementation]
 

Protected Attributes

UIButton * menuButton
 
UIButton * snapMealButton
 
UIButton * timelineButton
 
UIButton * editorButton
 
UIButton * healthkitButton
 
CGRect menuButtonFramePortrait
 
CGRect snapMealButtonFramePortrait
 
CGRect timelineButtonFramePortrait
 
CGRect editorButtonFramePortrait
 
CGRect healthkitButtonFramePortrait
 
CGRect menuButtonFrameLandscape
 
CGRect snapMealButtonFrameLandscape
 
CGRect timelineButtonFrameLandscape
 
CGRect editorButtonFrameLandscape
 
CGRect healthkitButtonFrameLandscape
 
UIImageView * backgrdImageView
 
NSString * rootPortraitBackgroundName
 
NSString * rootLandscapeBackgroundName
 

Detailed Description

toMenuNavigationRoot.png
dot_inline_dotgraph_21.png

Definition at line 15 of file ZCMNutritionRootViewController.h.

Method Documentation

◆ createFiveButtons()

- (void) createFiveButtons
implementation

Definition at line 335 of file ZCMNutritionRootViewController.m.

336 {
337  UIImage *pomegraniteSeedsImage = [UIImage imageNamed:@"pomegraniteSeedWhtCtr120.png"];
338 
339  CGRect zeroButtonFrame = CGRectMake(100, 100, 100, 100);
340 
341  // "Today's Menu"
342  menuButton = [Z5DataController makeGradientButton:@"Today's Menu" withFrame:zeroButtonFrame andFont:nil];
343  UIImage *menuButtonImage = [UIImage imageNamed:@"menuIcon60.png"];
344  [menuButton setImage:menuButtonImage forState:UIControlStateNormal];
345  [menuButton setBackgroundImage:pomegraniteSeedsImage forState:UIControlStateNormal];
346  [menuButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
347  [menuButton setTitleShadowColor:[UIColor blackColor] forState:UIControlStateNormal];
348  // [menuButton addMask];
349 
350  // "Snap a Meal"
351  snapMealButton = [Z5DataController makeGradientButton:@"Snap" withFrame:zeroButtonFrame andFont:nil];
352  UIImage *snapMealButtonImage = [UIImage imageNamed:@"cameraIcon60.png"];
353  [snapMealButton setImage:snapMealButtonImage forState:UIControlStateNormal];
354  [snapMealButton setBackgroundImage:pomegraniteSeedsImage forState:UIControlStateNormal];
355  [snapMealButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
356  [snapMealButton setTitleShadowColor:[UIColor blackColor] forState:UIControlStateNormal];
357 
358  // "Recent Meals"
359  timelineButton = [Z5DataController makeGradientButton:@"Recent Meals" withFrame:zeroButtonFrame andFont:nil];
360  UIImage *timelineButtonImage = [UIImage imageNamed:@"calendarIcon60.png"];
361  [timelineButton setImage:timelineButtonImage forState:UIControlStateNormal];
362  [timelineButton setBackgroundImage:pomegraniteSeedsImage forState:UIControlStateNormal];
363  [timelineButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
364  [timelineButton setTitleShadowColor:[UIColor blackColor] forState:UIControlStateNormal];
365 
366  // "Gallery editor"
367  editorButton = [Z5DataController makeGradientButton:@"Kitchen" withFrame:zeroButtonFrame andFont:nil];
368  UIImage *editorButtonImage = [UIImage imageNamed:@"kitchenIcon60.png"];
369  [editorButton setImage:editorButtonImage forState:UIControlStateNormal];
370  [editorButton setBackgroundImage:pomegraniteSeedsImage forState:UIControlStateNormal];
371  [editorButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
372  [editorButton setTitleShadowColor:[UIColor blackColor] forState:UIControlStateNormal];
373 
374 
375  UIFont *healthKitButtonFont = [UIFont fontWithName:@"Georgia-Bold" size:24.0];
376  healthkitButton = [Z5DataController makeGradientButton:@"Apple Healthkit" withFrame:zeroButtonFrame andFont:healthKitButtonFont];
377  UIImage *healthkitButtonImage = [UIImage imageNamed:@"heartIcon60.png"];
378  [healthkitButton setImage:healthkitButtonImage forState:UIControlStateNormal];
379  [healthkitButton setBackgroundImage:pomegraniteSeedsImage forState:UIControlStateNormal];
380  [healthkitButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
381  [healthkitButton setTitleShadowColor:[UIColor blackColor] forState:UIControlStateNormal];
382 
383 }
static Y3GradientButton * menuButton
Singleton interface to both core and remote data sources.
UIButton * makeGradientButton:withFrame:andFont:(NSString *caption, [withFrame] CGRect buttonFrame, [andFont] UIFont *buttonFont)

◆ deviceOrientationDidChange:()

- (void) deviceOrientationDidChange: (NSNotification *)  notification
implementation

Thanks to http://stackoverflow.com/questions/12126098/how-to-detect-rotation-for-a-programatically-generated-uiview

Definition at line 155 of file ZCMNutritionRootViewController.m.

155  :(NSNotification *)notification {
156  // NSLog(@"ZCMNutritionRootViewController.deviceOrientationDidChange: %@", notification);
157  [self orientAppearUI];
158 }

◆ didReceiveMemoryWarning()

- (void) didReceiveMemoryWarning
implementation

Definition at line 566 of file ZCMNutritionRootViewController.m.

566  {
567  [super didReceiveMemoryWarning];
568  // Dispose of any resources that can be recreated.
569 }

◆ goToEditorScreen()

- (void) goToEditorScreen
implementation

Definition at line 460 of file ZCMNutritionRootViewController.m.

460  {
461  NSLog(@"NutritionRoot.goToEditorScreen");
463  [[self navigationController] pushViewController:vc5 animated:YES];
464 }

◆ goToHealthKitScreen()

- (void) goToHealthKitScreen
implementation

Definition at line 465 of file ZCMNutritionRootViewController.m.

465  {
466  NSLog(@"NutritionRoot.goToHealthKitScreen");
467  T1HealthKitViewController *vc3 = [[T1HealthKitViewController alloc] initWithStyle:UITableViewStyleGrouped];
468  [[self navigationController] pushViewController:vc3 animated:YES];
469 }

◆ goToMenuScreen()

- (void) goToMenuScreen
implementation

Definition at line 430 of file ZCMNutritionRootViewController.m.

430  {
431  Z5LocalDataController *localData = [[Z5DataController sharedInstance] localDataController];
433  [localData logTodaysMenu:@"didFinishLaunchingWithOptions"];
434 
435  if (0 == [[localData todaysMenuItems] count]) {
437  [self.navigationController pushViewController:vc animated:YES];
438  } else {
439  Y4MenuPostViewController *menuPostVC = [[Y4MenuPostViewController alloc] init];
440  [self.navigationController pushViewController:menuPostVC animated:YES];
441  }
442 
443 }
instancetype sharedInstance()
void logTodaysMenu:(NSString *caption)
NSMutableArray * createTodaysMenuFromUserDefaults()
Singleton interface to both core and remote data sources.

◆ goToOriginateScreen()

- (void) goToOriginateScreen
implementation

Definition at line 455 of file ZCMNutritionRootViewController.m.

455  {
456  NSLog(@"NutritionRoot.goToOriginateScreen");
458  [[self navigationController] pushViewController:vc3 animated:YES];
459 }

◆ goToSnapMealScreen()

- (void) goToSnapMealScreen
implementation

Definition at line 444 of file ZCMNutritionRootViewController.m.

444  {
446  usingDelegate: (id <UINavigationControllerDelegate, UIImagePickerControllerDelegate>) self];
447 }
BOOL startCameraControllerFromViewController:usingDelegate:(UIViewController *controller, [usingDelegate] id< UINavigationControllerDelegate, UIImagePickerControllerDelegate > delegate)

◆ goToTimelineScreen()

- (void) goToTimelineScreen
implementation

Definition at line 448 of file ZCMNutritionRootViewController.m.

448  {
449  NSLog(@"NutritionRoot.goToTimelineScreen");
451  [[self navigationController] pushViewController:vc2 animated:YES];
452 // CalendarDemoViewController *vc2 = [[CalendarDemoViewController alloc] init];
453 // [[self navigationController] pushViewController:vc2 animated:YES];
454 }

◆ imagePickerController:didFinishPickingMediaWithInfo:()

- (void) imagePickerController: (UIImagePickerController *)  picker
didFinishPickingMediaWithInfo: (NSDictionary<NSString *,id> *)  info 
implementation

Definition at line 489 of file ZCMNutritionRootViewController.m.

489  :(UIImagePickerController *)picker
490 didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
491 {
492  // NSLog(@"CameraSnap.didFinishPickingMediaWithInfo: info: %@", info);
493  // UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
494 
495  NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
496  UIImage *originalImage, *editedImage, *imageToSave;
497 
498  // Handle a still image capture
499  if (CFStringCompare ((CFStringRef) mediaType, kUTTypeImage, 0)
500  == kCFCompareEqualTo) {
501 
502  editedImage = (UIImage *) [info objectForKey:
503  UIImagePickerControllerEditedImage];
504  originalImage = (UIImage *) [info objectForKey:
505  UIImagePickerControllerOriginalImage];
506 
507  if (editedImage) {
508  imageToSave = editedImage;
509  } else {
510  imageToSave = originalImage;
511  }
512 
513 // Originally, example saved the new image (original or
514 // edited) to the Camera Roll:
515 // UIImageWriteToSavedPhotosAlbum (imageToSave, nil, nil , nil);
516 
517  // within the app, at this poing a meal is created, the image
518  // set according to what we have, and the time/date. The meal is
519  // provided as input to the snapMealEntryVC
520 
521  Z5LocalDataController *localData = [[Z5DataController sharedInstance] localDataController];
522  NSDate *nowDate = [NSDate dateWithTimeIntervalSinceNow:0];
523  NSArray <Meal *> *snapmeals = [localData findOrCreateMealWithDate:nowDate];
524  Meal *snapMeal = [snapmeals lastObject];
525  snapMeal.photo = UIImagePNGRepresentation(imageToSave);
526 
527  P2SnapMealEntryViewController *mealSnapReview = [[P2SnapMealEntryViewController alloc] init];
528  [mealSnapReview setFocusImage:imageToSave];
529  [mealSnapReview setFocusMeal:snapMeal];
530  [mealSnapReview setMealDelegate:self];
531  [self.navigationController pushViewController:mealSnapReview animated:YES];
532  }
533 
534  // Handle a movie capture
535  if (CFStringCompare ((CFStringRef) mediaType, kUTTypeMovie, 0)
536  == kCFCompareEqualTo) {
537 
538  NSString *moviePath = [[info objectForKey:
539  UIImagePickerControllerMediaURL] path];
540 
541  if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum (moviePath)) {
542  UISaveVideoAtPathToSavedPhotosAlbum (
543  moviePath, nil, nil, nil);
544  }
545  }
546 
547  [picker dismissViewControllerAnimated:YES completion:nil];
548 
549 }
instancetype sharedInstance()
NSArray< Meal * > * findOrCreateMealWithDate:(NSDate *findDate)
Singleton interface to both core and remote data sources.
NSData * photo

◆ imagePickerControllerDidCancel:()

- (void) imagePickerControllerDidCancel: (UIImagePickerController *)  picker
implementation

Definition at line 560 of file ZCMNutritionRootViewController.m.

560  :(UIImagePickerController *)picker
561 {
562  NSLog(@"CameraSnap.imagePickerControllerDidCancel");
563  [picker dismissViewControllerAnimated:YES completion:nil];
564 };

◆ init()

- (id) init
implementation

Definition at line 85 of file ZCMNutritionRootViewController.m.

86 {
87  self = [super init];
88  if (self) {
89  self.title = @"Nutrition";
90  rootPortraitBackgroundName = @"Wine-cheese-bread-grapes.png";
91  rootLandscapeBackgroundName = @"honeyCheeseGrapesWineBread.png";
92  }
93  return self;
94 }

◆ orientAppearUI()

- (void) orientAppearUI
implementation

Definition at line 187 of file ZCMNutritionRootViewController.m.

187  {
188  UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
189  switch (orientation)
190  {
191  case UIDeviceOrientationPortrait:
192  case UIDeviceOrientationFaceUp:
193  {
194  [self positionFramesPortrait];
195  [self viewDidAppearPortrait];
196  }
197  break;
198  case UIDeviceOrientationLandscapeLeft:
199  case UIDeviceOrientationLandscapeRight:
200  {
201  [self positionFramesLandscape];
202  [self viewDidAppearLandscape];
203  }
204  break;
205  default:
206  {
207  ;
208  }
209  break;
210  }
211 }

◆ orientLoadUI()

- (void) orientLoadUI
implementation

Definition at line 161 of file ZCMNutritionRootViewController.m.

161  {
162 
163  UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
164  switch (orientation)
165  {
166  case UIDeviceOrientationPortrait:
167  case UIDeviceOrientationFaceUp:
168  {
169  [self positionFramesPortrait];
170  [self viewDidLoadPortrait];
171  }
172  break;
173  case UIDeviceOrientationLandscapeLeft:
174  case UIDeviceOrientationLandscapeRight:
175  {
176  [self positionFramesLandscape];
177  [self viewDidLoadLandscape];
178  }
179  break;
180  default:
181  {
182  ;
183  }
184  break;
185  }
186 }

◆ placeLogoutButton()

- (void) placeLogoutButton
implementation

Definition at line 418 of file ZCMNutritionRootViewController.m.

419 {
420  Z5GoogleLoginController *googleLogin = [[[Z5DataController sharedInstance] remoteDataController] loginController];
421 
422  UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Logout"
423  style:UIBarButtonItemStylePlain
424  target:googleLogin
425  action:@selector(logOutGoogle)];
426  self.navigationItem.rightBarButtonItem = anotherButton;
427  self.navigationItem.rightBarButtonItem.enabled = YES;
428 }
instancetype sharedInstance()
Singleton interface to both core and remote data sources.

◆ positionFramesLandscape()

- (void) positionFramesLandscape
implementation

Definition at line 299 of file ZCMNutritionRootViewController.m.

300 {
301  CGRect totalFrame = self.view.frame;
302  float buttonTop = totalFrame.size.height * 0.15 ;
303  float leftButtonLeft = totalFrame.size.width * 0.04;
304  float buttonWidth = 66;
305  float buttonHeight = 70;
306  float buttonInterval = 8.0;
307 
308  float buttonLeft = leftButtonLeft;
309  menuButtonFrameLandscape = CGRectMake(buttonLeft,
310  buttonTop,
311  buttonWidth,
312  buttonHeight );
313  buttonLeft += (buttonWidth + buttonInterval);
314  snapMealButtonFrameLandscape = CGRectMake(buttonLeft,
315  buttonTop,
316  buttonWidth,
317  buttonHeight);
318  buttonLeft += (buttonWidth + buttonInterval);
319  timelineButtonFrameLandscape = CGRectMake(buttonLeft,
320  buttonTop,
321  buttonWidth,
322  buttonHeight);
323  buttonLeft += (buttonWidth + buttonInterval);
324  editorButtonFrameLandscape = CGRectMake(buttonLeft,
325  buttonTop,
326  buttonWidth,
327  buttonHeight);
328  buttonLeft += (buttonWidth + buttonInterval);
329  healthkitButtonFrameLandscape = CGRectMake(buttonLeft,
330  buttonTop,
331  buttonWidth,
332  buttonHeight);
333 }

◆ positionFramesPortrait()

- (void) positionFramesPortrait
implementation

Definition at line 264 of file ZCMNutritionRootViewController.m.

265 {
266  CGRect totalFrame = self.view.frame;
267  float topButtonTop = totalFrame.size.height * 0.40;
268  float leftMargin = totalFrame.size.width * 0.04;
269  float buttonWidth = totalFrame.size.width * 0.72;
270  float buttonHeight = 70; // totalFrame.size.height * 0.08;
271  float buttonInterval = 8.0;
272 
273  float buttonTop = topButtonTop;
274  menuButtonFramePortrait = CGRectMake(leftMargin,
275  buttonTop,
276  buttonWidth,
277  buttonHeight);
278  buttonTop += (buttonHeight + buttonInterval);
279  snapMealButtonFramePortrait = CGRectMake(leftMargin,
280  buttonTop,
281  buttonWidth,
282  buttonHeight);
283  buttonTop += (buttonHeight + buttonInterval);
284  timelineButtonFramePortrait = CGRectMake(leftMargin,
285  buttonTop,
286  buttonWidth,
287  buttonHeight);
288  buttonTop += (buttonHeight + buttonInterval);
289  editorButtonFramePortrait = CGRectMake(leftMargin,
290  buttonTop,
291  buttonWidth,
292  buttonHeight);
293  buttonTop += (buttonHeight + buttonInterval);
294  healthkitButtonFramePortrait = CGRectMake(leftMargin,
295  buttonTop,
296  buttonWidth,
297  buttonHeight);
298 }

◆ returnFromEntryReviewWithInfo:withCaption:()

- (void) returnFromEntryReviewWithInfo: (UIImage *)  imageToSave
withCaption: (NSString *)  caption 
implementation

Definition at line 550 of file ZCMNutritionRootViewController.m.

550  :(UIImage *)imageToSave withCaption:(NSString *)caption
551 {
552  Z5LocalDataController *localData = [[Z5DataController sharedInstance] localDataController];
553 
554  NSDate *nowDate = [NSDate dateWithTimeIntervalSinceNow:0];
555  NSArray<Meal *> *snapMealArr = [localData findOrCreateMealWithDate:nowDate];
556  Meal *snapMeal = [snapMealArr lastObject];
557  snapMeal.photo = UIImageJPEGRepresentation(imageToSave, 0.90);
558  snapMeal.galleryNumber = [NSNumber numberWithInt:1];
559 }
NSNumber * galleryNumber
instancetype sharedInstance()
NSArray< Meal * > * findOrCreateMealWithDate:(NSDate *findDate)
Singleton interface to both core and remote data sources.
NSData * photo

◆ reviewComplete()

- (void) reviewComplete
implementation

Definition at line 471 of file ZCMNutritionRootViewController.m.

472 {
473  NSLog(@"ZCMNutritionRootViewController.reviewComplete");
474 
475  // TODO: log/display meals
476 }

◆ signedIn:()

- (void) signedIn: (GIDGoogleUser *)  user
implementation

Definition at line 409 of file ZCMNutritionRootViewController.m.

409  : (GIDGoogleUser *)user
410 {
411  [self placeLogoutButton];
412 }

◆ signedOut:()

- (void) signedOut: (GIDGoogleUser *)  user
implementation

Definition at line 413 of file ZCMNutritionRootViewController.m.

413  :(GIDGoogleUser *)user
414 {
415  self.navigationItem.rightBarButtonItem = nil;
416 }

◆ toggleAppleHealthKit()

- (void) toggleAppleHealthKit
implementation

Definition at line 477 of file ZCMNutritionRootViewController.m.

477  {
478  NSNumber *usingHealthKit = [[[Z5DataController sharedInstance] localDataController] usingHealthKit];
479  Boolean updatedStatus = ![usingHealthKit boolValue];
480  [[[Z5DataController sharedInstance] localDataController] setUseHealthKit:updatedStatus];
481  if (updatedStatus) {
482  [self goToHealthKitScreen];
483  }
484 }
instancetype sharedInstance()
Singleton interface to both core and remote data sources.

◆ viewDidAppear:()

- (void) viewDidAppear: (BOOL)  animated
implementation

Definition at line 135 of file ZCMNutritionRootViewController.m.

135  :(BOOL)animated
136 {
137  // NSLog(@"NutritionRootView.viewDidAppear");
138  [self orientAppearUI];
139 
140  Z5GoogleLoginController *loginData = [[[Z5DataController sharedInstance] remoteDataController] loginController];
141 
142  if (loginData.signedIn.boolValue) {
143  [self placeLogoutButton];
144  }
145 }
instancetype sharedInstance()
Singleton interface to both core and remote data sources.

◆ viewDidAppearLandscape()

- (void) viewDidAppearLandscape
implementation

Definition at line 248 of file ZCMNutritionRootViewController.m.

249 {
250  // NSLog(@"ZCMNutritionRoolViewController.viewDidAppearLandscape");
251  [menuButton setFrame:menuButtonFrameLandscape];
252  [snapMealButton setFrame:snapMealButtonFrameLandscape];
253  [timelineButton setFrame:timelineButtonFrameLandscape];
254  [editorButton setFrame:editorButtonFrameLandscape];
255  [healthkitButton setFrame:healthkitButtonFrameLandscape];
256 
257  CGSize viewSize = self.view.frame.size;
258  UIImage *resizedImage = [Z5DataController imageNamed:rootLandscapeBackgroundName sizedToLandscape:viewSize];
259  [backgrdImageView setImage:resizedImage];
260 }
UIImage * imageNamed:sizedToLandscape:(NSString *imageName, [sizedToLandscape] CGSize imageSize)
Singleton interface to both core and remote data sources.

◆ viewDidAppearPortrait()

- (void) viewDidAppearPortrait
implementation

Definition at line 234 of file ZCMNutritionRootViewController.m.

235 {
236  // NSLog(@"ZCMNutritionRoolViewController.viewDidAppearPortrait");
237  [menuButton setFrame:menuButtonFramePortrait];
238  [snapMealButton setFrame:snapMealButtonFramePortrait];
239  [timelineButton setFrame:timelineButtonFramePortrait];
240  [editorButton setFrame:editorButtonFramePortrait];
241  [healthkitButton setFrame:healthkitButtonFramePortrait];
242 
243  CGSize viewSize = self.view.frame.size;
244  UIImage *resizedImage = [Z5DataController imageNamed:rootPortraitBackgroundName sizedToPortrait:viewSize];
245  [backgrdImageView setImage:resizedImage];
246 
247 }
UIImage * imageNamed:sizedToPortrait:(NSString *imageName, [sizedToPortrait] CGSize imageSize)
Singleton interface to both core and remote data sources.

◆ viewDidLoad()

- (void) viewDidLoad
implementation

This routine places the background image and the major buttons on the panel.

msc_boxes
Trial boxes

Definition at line 103 of file ZCMNutritionRootViewController.m.

103  {
104  [super viewDidLoad];
105 
106  // determine approriate frames
107  [self orientLoadUI];
108 
109  // do one-time creates and connects
110  [menuButton addTarget:self action:@selector(goToMenuScreen) forControlEvents:UIControlEventTouchUpInside];
111  [snapMealButton addTarget:self action:@selector(goToSnapMealScreen) forControlEvents:UIControlEventTouchUpInside];
112  [timelineButton addTarget:self action:@selector(goToTimelineScreen) forControlEvents:UIControlEventTouchUpInside];
113  [editorButton addTarget:self action:@selector(goToEditorScreen) forControlEvents:UIControlEventTouchUpInside];
114  [healthkitButton addTarget:self action:@selector(toggleAppleHealthKit) forControlEvents:UIControlEventTouchUpInside];
115  [self.view addSubview:menuButton];
116  [self.view addSubview:snapMealButton];
117  [self.view addSubview:timelineButton];
118  [self.view addSubview:editorButton];
119  [self.view addSubview:healthkitButton];
120 
121  [self orientAppearUI];
122 
123  [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
124  [[NSNotificationCenter defaultCenter] addObserver:self
125  selector:@selector(deviceOrientationDidChange:)
126  name: UIDeviceOrientationDidChangeNotification
127  object: nil];
128 
129  Z5GoogleLoginController *googleLogin = [[[Z5DataController sharedInstance] remoteDataController] loginController];
130  [googleLogin addLoginListener:self];
131 }
void addLoginListener:(id< Z5GoogleLoginListener > ear)
instancetype sharedInstance()
Singleton interface to both core and remote data sources.

◆ viewDidLoadLandscape()

- (void) viewDidLoadLandscape
implementation

Definition at line 223 of file ZCMNutritionRootViewController.m.

224 {
225  CGSize viewSize = self.view.frame.size;
226  UIImage *resizedImage = [Z5DataController imageNamed:rootLandscapeBackgroundName sizedToLandscape:viewSize];
227  backgrdImageView = [[UIImageView alloc] initWithImage:resizedImage];
228  [backgrdImageView setContentMode:UIViewContentModeScaleAspectFill];
229  [self.view addSubview:backgrdImageView];
230 
231  [self createFiveButtons];
232 }
UIImageView * backgrdImageView
UIImage * imageNamed:sizedToLandscape:(NSString *imageName, [sizedToLandscape] CGSize imageSize)
Singleton interface to both core and remote data sources.

◆ viewDidLoadPortrait()

- (void) viewDidLoadPortrait
implementation

Definition at line 213 of file ZCMNutritionRootViewController.m.

214 {
215  CGSize viewSize = self.view.frame.size;
216  UIImage *resizedImage = [Z5DataController imageNamed:rootPortraitBackgroundName sizedToPortrait:viewSize];
217  backgrdImageView = [[UIImageView alloc] initWithImage:resizedImage];
218  [backgrdImageView setContentMode:UIViewContentModeScaleAspectFill];
219  [self.view addSubview:backgrdImageView];
220 
221  [self createFiveButtons];
222 }
UIImageView * backgrdImageView
UIImage * imageNamed:sizedToPortrait:(NSString *imageName, [sizedToPortrait] CGSize imageSize)
Singleton interface to both core and remote data sources.

◆ viewWillDisappear:()

- (void) viewWillDisappear: (BOOL)  animated
implementation

Definition at line 146 of file ZCMNutritionRootViewController.m.

146  :(BOOL)animated
147 {
148  // save database to user defaults
149  Z5LocalDataController *localData = [[Z5DataController sharedInstance] localDataController];
150  [localData saveContext];
151 }
instancetype sharedInstance()
Singleton interface to both core and remote data sources.

Member Data Documentation

◆ backgrdImageView

- (UIImageView*) backgrdImageView
protected

Definition at line 45 of file ZCMNutritionRootViewController.m.

◆ editorButton

- (UIButton*) editorButton
protected

Definition at line 31 of file ZCMNutritionRootViewController.m.

◆ editorButtonFrameLandscape

- (CGRect) editorButtonFrameLandscape
protected

Definition at line 42 of file ZCMNutritionRootViewController.m.

◆ editorButtonFramePortrait

- (CGRect) editorButtonFramePortrait
protected

Definition at line 37 of file ZCMNutritionRootViewController.m.

◆ healthkitButton

- (UIButton*) healthkitButton
protected

Definition at line 32 of file ZCMNutritionRootViewController.m.

◆ healthkitButtonFrameLandscape

- (CGRect) healthkitButtonFrameLandscape
protected

Definition at line 43 of file ZCMNutritionRootViewController.m.

◆ healthkitButtonFramePortrait

- (CGRect) healthkitButtonFramePortrait
protected

Definition at line 38 of file ZCMNutritionRootViewController.m.

◆ menuButton

- (UIButton*) menuButton
protected

Definition at line 28 of file ZCMNutritionRootViewController.m.

◆ menuButtonFrameLandscape

- (CGRect) menuButtonFrameLandscape
protected

Definition at line 39 of file ZCMNutritionRootViewController.m.

◆ menuButtonFramePortrait

- (CGRect) menuButtonFramePortrait
protected

Definition at line 34 of file ZCMNutritionRootViewController.m.

◆ rootLandscapeBackgroundName

- (NSString*) rootLandscapeBackgroundName
protected

Definition at line 47 of file ZCMNutritionRootViewController.m.

◆ rootPortraitBackgroundName

- (NSString*) rootPortraitBackgroundName
protected

Definition at line 46 of file ZCMNutritionRootViewController.m.

◆ snapMealButton

- (UIButton*) snapMealButton
protected

Definition at line 29 of file ZCMNutritionRootViewController.m.

◆ snapMealButtonFrameLandscape

- (CGRect) snapMealButtonFrameLandscape
protected

Definition at line 40 of file ZCMNutritionRootViewController.m.

◆ snapMealButtonFramePortrait

- (CGRect) snapMealButtonFramePortrait
protected

Definition at line 35 of file ZCMNutritionRootViewController.m.

◆ timelineButton

- (UIButton*) timelineButton
protected

Definition at line 30 of file ZCMNutritionRootViewController.m.

◆ timelineButtonFrameLandscape

- (CGRect) timelineButtonFrameLandscape
protected

Definition at line 41 of file ZCMNutritionRootViewController.m.

◆ timelineButtonFramePortrait

- (CGRect) timelineButtonFramePortrait
protected

Definition at line 36 of file ZCMNutritionRootViewController.m.


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