31 NSValue *ret = [NSValue valueWithCGSize:mealDefaultCellSize];
35 - (instancetype) initWithFrame:(CGRect)frame andDelegate:(
id<Z6MealPanoramaDelegate>)dele
37 self = [
super initWithFrame:frame];
39 mealBackgroundShade = [UIColor colorWithRed:226.0/256 green:201.0/256 blue:114.0/256 alpha:1.0];
49 float defaultCellwidth = 224;
50 float defaultCellheight = 268;
52 float selectCellWidth = 156;
53 float selectCellHeight = 180;
58 [mealFlowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
59 [mealFlowLayout setMinimumInteritemSpacing:1.0];
60 [mealFlowLayout setItemSize:mealDefaultCellSize];
64 mealCollectionView = [[UICollectionView alloc] initWithFrame:collectionViewFrame collectionViewLayout:mealFlowLayout];
65 [
self addSubview:mealCollectionView];
67 [mealCollectionView setDelegate:self];
68 [mealCollectionView setDataSource:self];
70 [mealCollectionView setBackgroundColor:[[
Z5DataController alloc] wheatColor]];
73 [mDateFormatter setDateStyle:NSDateFormatterMediumStyle];
74 [mDateFormatter setTimeStyle:NSDateFormatterShortStyle];
79 [mealCollectionView reloadData];
86 [mealCollectionView registerClass:[
U5MealCollectionViewCell class] forCellWithReuseIdentifier:selectedCellIdentifier];
91 #pragma mark - Z6ContainedView 98 - (void) appear:(CGRect)bound
100 NSNumber *galleryChoice = [NSNumber numberWithInt:1];
104 NSLog(
@"U5MenuPanoramaView.appear: width: %3.2f self-width: %3.2f", bound.size.width,
self.bounds.size.width);
105 [
self setSnapMeals:[[NSMutableArray alloc] initWithArray:tmp]];
109 [mealCollectionView setBackgroundColor:[UIColor yellowColor]];
110 [mealCollectionView reloadData];
116 #pragma mark - UICollectionViewDataSource 118 numberOfItemsInSection:(NSInteger)section
120 NSInteger ret = [_snapMeals count];
121 NSLog(
@"U5MealPanoramaView.numberOfItemsInSection: %ld", (
long)ret);
124 - (__kindof UICollectionViewCell *)
collectionView:(UICollectionView *)collectionView
125 cellForItemAtIndexPath:(NSIndexPath *)indexPath
127 int imageHeight = 120;
128 int selectedImageHeight = 160;
129 int outputImageHeight = 0;
134 outputImageHeight = selectedImageHeight;
137 outputImageHeight = imageHeight;
141 Meal *cellItem = [_snapMeals objectAtIndex:indexPath.row];
142 UIImage *photoImage = [UIImage imageWithData:cellItem.photo];
144 NSString *itemName = [mDateFormatter stringFromDate:photoDate];
147 CGSize photoSize = [photoImage size];
148 float resizeRatio = photoSize.height / (float)outputImageHeight;
149 UIImage *keptImage = [UIImage imageWithCGImage:[photoImage CGImage]
150 scale:photoImage.scale * resizeRatio
151 orientation:(photoImage.imageOrientation) ];
153 [cell.imageView setImage:keptImage];
NSInteger selectedMealRow
UICollectionView * mealCollectionView
id< Z6MealPanoramaDelegate > mealPanoramaDelegate
NSValue * mealCellDefaultSize()
float heightRequirement()
UICollectionViewFlowLayout * mealFlowLayout
CGSize mealDefaultCellSize
instancetype sharedInstance()
NSArray< Meal * > * retrieveAllMeals:(NSNumber *galleryNumber)
CGSize mealSelectCellSize
UIColor * mealBackgroundShade
float initialCollectViewHgt
NSDateFormatter * mDateFormatter
static NSString * selectedCellIdentifier
Singleton interface to both core and remote data sources.
void labelize:withText:(UILabel *targLabel, [withText] NSString *txt)
static NSString * cellIdentifier