Today's Menu  Portugal
journal and plan nutrition
P2SnapMealEntryViewController.m
Go to the documentation of this file.
1 //
2 // P2SnapMealEntryViewController.m
3 // TodaysMenu
4 //
5 // Created by Don Zeek on 1/8/19.
6 // Copyright © 2019 net.dzeek.y2015.ios.portfolio. All rights reserved.
7 //
8 
10 #import "P2SnapMealInfoView.h"
11 
13 
14 @end
15 
16 @implementation P2SnapMealEntryViewController
17 {
18 float topOfPageFloat;
19 float featuresWidthFloat;
21 }
22 
23 - (void)viewDidLoad {
24  [super viewDidLoad];
25  // Do any additional setup after loading the view.
26  self.title = @"Snap Meal Captioning";
27  [self.view setBackgroundColor:[UIColor colorWithHue:0.27 saturation:0.5 brightness:0.7 alpha:1.0]];
28 
29  // topOfPage, imageHeight, featuresWidth,
30  // and sideMarginWidth are class vars
31  CGRect totalFrame = self.view.frame;
32  CGRect topNavigationFrame = [[[self navigationController] navigationBar] frame];
33  // CGSize buttonSize = CGSizeMake(totalFrame.size.width * 0.42, 40.0);
34 
35  topOfPageFloat = topNavigationFrame.origin.y + topNavigationFrame.size.height;
36  featuresWidthFloat = totalFrame.size.width - 16;
37  float featureHeight = totalFrame.size.height - topOfPageFloat - 16;;
38  // sideMarginWidth = [[NSNumber alloc] initWithFloat:sideMarginWidthFloat];
39 
40  // get and scale image for background
41  UIImage *backgrdImage = [UIImage imageNamed:@"coffeecakeBackground.png"];
42  CGSize photoSize = [backgrdImage size];
43  float resizeRatio = photoSize.height / totalFrame.size.height;
44  UIImage *resizedImage = [UIImage imageWithCGImage:[backgrdImage CGImage]
45  scale:backgrdImage.scale * resizeRatio
46  orientation:(backgrdImage.imageOrientation) ];
47  UIImageView *backgrd = [[UIImageView alloc] initWithImage:resizedImage];
48  [self.view addSubview:backgrd];
49  // end - get and scale image for background
50 
51  // create section 0 header and footer views
52  CGRect mealViewFrame = CGRectMake(4, topOfPageFloat+4, featuresWidthFloat, featureHeight);
53  // P2SnapMealInfoView *mealView = [[P2SnapMealInfoView alloc] initWithImage:_focusImage inFrame:mealViewFrame delegate:self];
54  P2SnapMealInfoView *mealView = [[P2SnapMealInfoView alloc] initWithMeal:_focusMeal inFrame:mealViewFrame delegate:self];
55  [self.view addSubview:mealView];
56 }
57 
59 {
60  NSLog(@"P2SnapMealEntryViewController.reviewComplete");
61 
62  //
63  [_mealDelegate reviewComplete];
64 
65  // [self dismissViewControllerAnimated:NO completion:nil];
66  [self.navigationController popViewControllerAnimated:NO];
67 }
68 /*
69 #pragma mark - Navigation
70 
71 // In a storyboard-based application, you will often want to do a little preparation before navigation
72 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
73  // Get the new view controller using [segue destinationViewController].
74  // Pass the selected object to the new view controller.
75 }
76 */
77 
78 @end
void viewDidLoad()
float featuresWidthFloat
void reviewComplete()
float sideMarginWidthFloat