15 @property (strong, nonatomic)
Meal *snapMeal;
21 UIImageView *snapMealImageView;
46 - (instancetype) initWithMeal:(
Meal *)meal inFrame:(CGRect)frame delegate:(
id<P2SnapMealInfoProtocol>)delegate
48 self = [
super initWithFrame:frame];
55 UIImage *mealImage = [UIImage imageWithData:meal.photo];
56 [snapMealImageView setImage:mealImage];
62 float totalWidth =
self.bounds.size.width;
63 float totalHeight =
self.bounds.size.height;
68 snapMealImageView = [[UIImageView alloc] initWithFrame:focusMealImageFrame];
69 [snapMealImageView.layer setBorderColor: [[UIColor blackColor] CGColor]];
70 [snapMealImageView.layer setBorderWidth: 2.0];
71 snapMealImageView.layer.cornerRadius = 8.0f;
72 snapMealImageView.layer.masksToBounds = YES;
73 snapMealImageView.image = [UIImage imageWithData:_focusMeal.photo];
74 [
self addSubview:snapMealImageView];
76 UIFont *herefont = [UIFont fontWithName:@"Helvetica-Bold" size:22];
77 NSDictionary *attribs = @{
78 NSForegroundColorAttributeName: [UIColor blackColor],
79 NSFontAttributeName: herefont
85 UIImage *reviewApprovalImage = [UIImage imageNamed:@"finishIcon60.png"];
86 [reviewApprovalButton setImage:reviewApprovalImage forState:UIControlStateNormal];
87 [reviewApprovalButton addTarget:mMealInfoDelegate action:@selector(reviewComplete) forControlEvents:UIControlEventTouchUpInside];
88 [
self addSubview:reviewApprovalButton];
90 NSString *focusName = [_focusMeal caption];
92 NSMutableAttributedString *attributedText =
93 [[NSMutableAttributedString alloc] initWithString:focusName
95 [snapMealCaptionTextField setAttributedText:attributedText];
97 [snapMealCaptionTextField setPlaceholder:@"enter menu item name"];
99 [snapMealCaptionTextField setTextAlignment:NSTextAlignmentCenter];
102 [snapMealCaptionTextField setDelegate:self];
103 [
self addSubview:snapMealCaptionTextField];
106 - (void) appear: (CGRect) bound
108 NSLog(
@"MenuMealInfoView.appear: width: %3.2f outer: %3.2f",
self.bounds.size.width, bound.size.width);
110 [snapMealImageView setFrame:focusMealImageFrame];
111 [snapMealCaptionTextField setFrame:mealCaptionFrame];
117 #pragma mark - UITextFieldDelegate 118 - (void)textFieldDidEndEditing:(UITextField *)textField
120 [
self.focusMeal setCaption:[textField text]];
122 - (BOOL)textFieldShouldReturn:(UITextField *)textField {
123 [textField resignFirstResponder];
id< P2SnapMealInfoProtocol > mMealInfoDelegate
CGRect reviewApproveFrame
instancetype sharedInstance()
CGRect focusMealImageFrame
float heightRequirement()
id< U7ParamEditControlDelegate > delegate
Singleton interface to both core and remote data sources.
UITextField * snapMealCaptionTextField
UIButton * reviewApprovalButton