Today's Menu  Portugal
journal and plan nutrition
Z3MenuJournalView.m
Go to the documentation of this file.
1 //
2 // Z3MenuJournalView.m
3 // TodaysMenu
4 //
5 // Created by Don Zeek on 12/30/17.
6 // Copyright © 2017 net.dzeek.y2015.ios.portfolio. All rights reserved.
7 //
8 
9 #import "Z3MenuJournalView.h"
12 
13 @implementation Z3MenuJournalView
14 {
15  UIButton *checkButton;
16  UIDatePicker *mealJournalDatePick;
18 }
19 id<Z6MenuJournalDelegate> menuJournalDelegate;
20 float timePickerHeight = 80.0;
21 float starRatingHeight = 58;
23 
24 - (instancetype) initWithDelegate:(id<Z6MenuJournalDelegate>) delegate
25 {
26  self = [super init];
27  if (self) {
30  }
31  return self;
32 }
33 
35 {
36  float ret = timePickerHeight + starRatingHeight;
37  return ret;
38 }
39 - (void) appear:(CGRect)bound
40 {
41  UIColor *blueCheeseSpotColor = [UIColor colorWithRed:196.0/256 green:220.0/256 blue:180.0/256 alpha:1.0];
42  [self setBackgroundColor:blueCheeseSpotColor];
43 
44  CGRect timePickerFrame = CGRectMake(2.0, 2.0, bound.size.width - 6.0, timePickerHeight);
45  mealJournalDatePick = [[UIDatePicker alloc] initWithFrame:timePickerFrame];
46  [mealJournalDatePick setMinuteInterval:10];
47  int finishedDinnerTenMinutesAgoSeconds = - (10.0 * 60.0);
48  NSDate *dinnerTime = [NSDate dateWithTimeIntervalSinceNow:finishedDinnerTenMinutesAgoSeconds];
49  [mealJournalDatePick setDate:dinnerTime];
50  NSDate *now = [NSDate dateWithTimeIntervalSinceNow:0];
51  [mealJournalDatePick setMaximumDate:now];
52  [self addSubview:mealJournalDatePick];
53 
54  float starRatingFrameWidth = bound.size.width - checkButtonWidth - 6.0;
55  CGRect starRatingFrame = CGRectMake(2.0,
56  timePickerHeight + 4.0,
57  starRatingFrameWidth,
59  starRating = [[DLStarRatingControl alloc] initWithFrame:starRatingFrame];
60  [starRating setDelegate:self];
61  [self addSubview:starRating];
62 
63  CGRect checkButtonFrame = CGRectMake(bound.size.width - checkButtonWidth - 6.0,
65  checkButtonWidth - 4,
67  checkButton = [[UIButton alloc] initWithFrame:checkButtonFrame];
68  // checkButton = [[UIButton alloc] initWithFrame:checkButtonFrame];
69  // [checkButton setBackgroundColor:[UIColor lightGrayColor]];
70  [checkButton setTitle:@"â0œ“" forState:UIControlStateNormal];
71  // [checkButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
72  [checkButton addTarget:self action:@selector(clickedCheck) forControlEvents:UIControlEventTouchUpInside];
73  [self addSubview:checkButton];
74 
75 }
76 
77 -(void)newRating:(DLStarRatingControl *)control :(float)rating
78 {
79  NSLog(@"MenuJournalView.newRating");
80  [menuJournalDelegate didTapRatingControl:rating];
81 }
82 - (void) clickedCheck
83 {
84  NSLog(@"MenuJournalView.clickedCheck");
85  [menuJournalDelegate didTapCheckFooter];
86 }
87 - (NSDate *) getMealJournalDate
88 {
89  return [mealJournalDatePick date];
90 }
91 /*
92 // Only override drawRect: if you perform custom drawing.
93 // An empty implementation adversely affects performance during animation.
94 - (void)drawRect:(CGRect)rect {
95  // Drawing code
96 }
97 */
98 
99 @end
id< Z6MenuJournalDelegate > menuJournalDelegate
float checkButtonWidth
UIDatePicker * mealJournalDatePick
DLStarRatingControl * starRating
id< U7ParamEditControlDelegate > delegate
float timePickerHeight
NSDate * getMealJournalDate()
float starRatingHeight