this method sorts through initialization data to find out what should be displayed. The options are to display a proposed complete menu (to be consumed), or to post up a series of meals for a given day.
72 self.title =
@"Y4MenuPostViewController";
74 + self.navigationController.navigationBar.frame.size.height;
77 CGRect totalFrame =
self.view.frame;
78 NSLog(
@"Y4MenuPostViewController.viewDidLoad: width: %3.2f", totalFrame.size.width);
81 NSLog(
@"MenuPostViewController.viewDidLoad: postingDate: %@", _postingDate);
82 for (
Meal *m in _postedMeals) {
83 NSSet *items = [m containedItem];
84 NSSortDescriptor *modelDescriptor = [NSSortDescriptor
85 sortDescriptorWithKey:@"name"
87 selector:@selector(caseInsensitiveCompare:)];
88 NSArray<NSSortDescriptor *> *descriptors = @[modelDescriptor];
89 NSArray *itemsAray = [items sortedArrayUsingDescriptors:descriptors];
90 NSLog(
@"MenuPostViewController.viewDidLoad: meal: %@", [m orderDate]);
92 NSLog(
@"MenuPostViewController.viewDidLoad: menuItem: %@", [mi name]);
98 UIImage *backgrdImage = [UIImage imageNamed:@"stillLifeWithWineAndCheese.png"];
99 CGSize photoSize = [backgrdImage size];
100 float resizeRatio = photoSize.height / totalFrame.size.height;
101 UIImage *resizedImage = [UIImage imageWithCGImage:[backgrdImage CGImage]
102 scale:backgrdImage.scale * resizeRatio
103 orientation:(backgrdImage.imageOrientation) ];
104 UIImageView *backgrd = [[UIImageView alloc] initWithImage:resizedImage];
105 [
self.view addSubview:backgrd];
115 NSMutableArray<MenuItem *> *proposedTodaysMenu = [localData
todaysMenuItems];
116 NSLog(
@"MenuPostViewController.viewDidLoad: proposedTodaysMenu: %@", proposedTodaysMenu);
118 if (proposedTodaysMeal) {
119 NSLog(
@"MenuPostViewController.viewDidLoad: proposedTodaysMeal: %@ -date: %@", proposedTodaysMeal, [proposedTodaysMeal orderDate]);
121 NSMutableArray *todayItems = [[NSMutableArray alloc] initWithArray:[[proposedTodaysMeal
containedItem] allObjects]];
122 [
self updateTodaysMenuView:todayItems];
124 }
else if ((0 == [proposedTodaysMenu count]) && (nil != _postedMeals)) {
125 [
self updateMenuSeriesView:_postedMeals];
128 NSMutableArray<MenuItem *> *todaysMenuItems = [localData
todaysMenuItems];
129 if (nil != todaysMenuItems) {
130 [
self updateTodaysMenuView:todaysMenuItems];
133 NSLog(
@"MenuPostViewController.viewDidLoad: sniffing at history, with meal edit in progress");
138 UISwipeGestureRecognizer *gesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipeMenu:)];
139 gesture.direction = UISwipeGestureRecognizerDirectionRight;
142 NSLog(
@"MenuPostViewController.viewDidLoad: end");
instancetype sharedInstance()
Singleton interface to both core and remote data sources.
NSSet< MenuItem * > * containedItem
NSMutableArray< MenuItem * > * todaysMenuItems