15 @property (strong, nonatomic)
MenuItem *focusMenuItem;
21 UIPickerView *menuItemGalleryPicker;
43 - (instancetype) initWithMenuItem: (
MenuItem *) menuItem andDelegate: (
id<Z6ItemFocusDelegate>) delegate
70 menuItemGalleryPicker = [[UIPickerView alloc] initWithFrame:galleryIdPickerFrame];
71 [menuItemGalleryPicker setDelegate:self];
72 [menuItemGalleryPicker setDataSource:self];
73 [menuItemGalleryPicker setBackgroundColor:[UIColor colorWithWhite:0.76 alpha:1.0]];
74 [menuItemGalleryPicker selectRow:focusGallery inComponent:0 animated:YES];
75 [
self addSubview:menuItemGalleryPicker];
78 [focusMenuItemImageView.layer setBorderColor: [[UIColor blackColor] CGColor]];
80 [focusMenuItemImageView.layer setBorderWidth: 2.0];
84 [
self addSubview:focusMenuItemImageView];
87 UIFont *herefont = [UIFont fontWithName:@"Helvetica-Bold" size:22];
88 NSDictionary *attribs = @{
89 NSForegroundColorAttributeName: [UIColor blackColor],
90 NSFontAttributeName: herefont
94 NSString *focusName = [_focusMenuItem name];
96 NSMutableAttributedString *attributedText =
97 [[NSMutableAttributedString alloc] initWithString:focusName
99 [menuItemNameTextField setAttributedText:attributedText];
101 [menuItemNameTextField setPlaceholder:@"enter menu item name"];
103 [menuItemNameTextField setTextAlignment:NSTextAlignmentCenter];
106 [menuItemNameTextField setDelegate:self];
107 [
self addSubview:menuItemNameTextField];
110 - (void) appear: (CGRect) bound
112 NSLog(
@"MenuItemFocusView.appear: width: %3.2f outer: %3.2f",
self.bounds.size.width, bound.size.width);
120 [menuItemGalleryPicker setFrame:galleryIdPickerFrame];
125 [focusMenuItemImageView setFrame:focusMenuItemImageFrame];
130 [menuItemNameTextField setFrame:menuItemNameFrame];
134 #pragma mark - UIPickerViewDelegate 138 - (CGFloat)pickerView:(UIPickerView *)pickerView
139 rowHeightForComponent:(NSInteger)component
146 - (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component
152 - (NSAttributedString *)pickerView:(UIPickerView *)pickerView
153 attributedTitleForRow:(NSInteger)row
154 forComponent:(NSInteger)component
157 NSLog(
@"Z6MenuItemFocusView.titleForRow: menuItemGalleryPicker");
169 UIFont *herefont = [UIFont fontWithName:@"Helvetica-Bold" size:16];
170 NSDictionary *attribs = @{
171 NSForegroundColorAttributeName: [UIColor blackColor],
172 NSFontAttributeName: herefont
174 NSMutableAttributedString *attributedText =
175 [[NSMutableAttributedString alloc] initWithString:ret
177 return attributedText;
179 -(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
183 NSLog(
@"Z6MenuItemFocusView.titleForRow: menuItemGalleryPicker");
195 UIFont *herefont = [UIFont fontWithName:@"Helvetica-Bold" size:20];
196 NSDictionary *attribs = @{
197 NSForegroundColorAttributeName: [UIColor blackColor],
198 NSFontAttributeName: herefont
200 NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:ret attributes:attribs];
203 UILabel *labelView = [[UILabel alloc] init];
204 [labelView setTextAlignment:NSTextAlignmentCenter];
205 labelView.attributedText = attributedString;
210 - (void)pickerView:(UIPickerView *)pickerView
211 didSelectRow:(NSInteger)row
212 inComponent:(NSInteger)component
215 NSLog(
@"Z6MenuItemFocusView.didSelectPickerRow (gallery picker): %ld", (
long)row);
218 NSNumber *rowNumber = [NSNumber numberWithLong:row];
219 [_focusMenuItem setGalleryNumber:rowNumber];
223 #pragma mark - UIPickerViewDataSource 224 - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
230 - (NSInteger)pickerView:(UIPickerView *)pickerView
231 numberOfRowsInComponent:(NSInteger)component
239 #pragma mark - UITextFieldDelegate 240 - (void)textFieldDidEndEditing:(UITextField *)textField
242 [
self.focusMenuItem setName:[textField text]];
255 - (BOOL)textFieldShouldReturn:(UITextField *)textField {
256 [textField resignFirstResponder];
instancetype sharedInstance()
Singleton interface to both core and remote data sources.