Today's Menu  Portugal
journal and plan nutrition
Z6MenuItemControlbar.m
Go to the documentation of this file.
1 //
2 // Z6MenuItemControlbar.m
3 // TodaysMenu
4 //
5 // Created by Don Zeek on 3/22/17.
6 // Copyright © 2017 net.dzeek.y2015.ios.portfolio. All rights reserved.
7 //
8 
11 
12 @implementation Z6MenuItemControlbar
13 {
14  UIButton *updateMenuItemButton;
15  UIButton *menuItemTodayButton;
16 }
17 
20 
21 - (instancetype) initWithFrame:(CGRect)frame andDelegate:(id<Z6MenuItemControlbarDelegate>) dele
22 {
23  self = [super initWithFrame:frame];
24  if (self) {
25 
26  _delegate = dele;
27  controlViewHeight = frame.size.height - 2;
28 
29  // add a button to update the selected menu item for today's (right now) meal
30  CGRect updateMenuIemButtonFrame = CGRectMake(2.0, 2.0, frame.size.width/2 - 4, controlViewHeight);
31  updateMenuItemButton = [[UIButton alloc] initWithFrame:updateMenuIemButtonFrame];
32  [updateMenuItemButton setTitle:@"update USDA" forState:UIControlStateNormal];
33  [updateMenuItemButton addTarget:self action:@selector(fireRecipeCheck) forControlEvents:UIControlEventTouchUpInside];
34  [self addSubview:updateMenuItemButton];
35  // end - add a button to update the selected menu item for today's (right now) meal
36 
37  // add a button to approve the selected menu item for today's (right now) meal
38  CGRect addToMenuButtonFrame = CGRectMake(frame.size.width/2 + 2, 2.0, frame.size.width/2 - 4, controlViewHeight);
39  menuItemTodayButton = [[UIButton alloc] initWithFrame:addToMenuButtonFrame];
40  [menuItemTodayButton setTitle:@"add menu item" forState:UIControlStateNormal];
41  [menuItemTodayButton addTarget:self action:@selector(addMenuItemOnToday:) forControlEvents:UIControlEventTouchUpInside];
42  [self addSubview:menuItemTodayButton];
43  // end - add a button to approve the selected menu item for today's (right now) meal
44  [self showBar:YES];
45  }
46  return self;
47 }
49 {
50  NSLog(@"MenuItemControlbar.fireRecipeCheck");
51  [_delegate fireRecipeCheck];
52 }
53 
54 - (void) addMenuItemOnToday:(UIButton *)sender {
55  NSLog(@"MenuItemControlbar.addMenuItemOnToday");
56  [_delegate addMenuItemOnToday:sender];
57 }
58 
60 {
61  return requestDisplayHeight;
62 }
63 
64 - (void) appear:(CGRect)bound
65 {
66  ;
67 }
68 - (void) showBar:(Boolean)flag
69 {
70  if (flag) {
72  } else {
74  }
75 }
76 /*
77 // Only override drawRect: if you perform custom drawing.
78 // An empty implementation adversely affects performance during animation.
79 - (void)drawRect:(CGRect)rect {
80  // Drawing code
81 }
82 */
83 
84 @end
void showBar:(Boolean flag)
UIButton * menuItemTodayButton
float controlViewHeight
float requestDisplayHeight