171 CGSize totalFrameSize =
self.view.frame.size;
172 CGRect topNavigationFrame = [[[
self navigationController] navigationBar] frame];
173 float topOfPageF = topNavigationFrame.origin.y + topNavigationFrame.size.height;
176 float dirButtonWidth = 60.0;
177 float centerLabelWidth = totalFrameSize.width - (2 * dirButtonWidth) - 8.0;
178 float buttonHeight = 46.0;
180 UIColor *buttonBckgrndColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.60 alpha:0.9];
183 float bckMonthButtonLeftEdge = 4.0f;
184 CGRect bckMonthFrame =CGRectMake(bckMonthButtonLeftEdge, topOfPageF, dirButtonWidth, buttonHeight);
186 [bckMonthButton setBackgroundColor:buttonBckgrndColor];
187 [bckMonthButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
188 [bckMonthButton addGradientFace:gradientBandColor];
189 [bckMonthButton setTitle:@"<<" forState:UIControlStateNormal];
190 [bckMonthButton addTarget:self action:@selector(didClickPageBck) forControlEvents:UIControlEventTouchUpInside];
191 [
self.view addSubview:bckMonthButton];
193 float dateHeaderButtonLeftEdge = dirButtonWidth + 8.0f;
194 float labelWidth = centerLabelWidth-4.0;
195 CGRect dateHeaderButtonFrame = CGRectMake(dateHeaderButtonLeftEdge, topOfPageF, labelWidth, buttonHeight);
197 [dateHeaderButton setBackgroundColor:[UIColor whiteColor]];
198 [dateHeaderButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
199 [dateHeaderButton addGradientFace:gradientBandColor];
200 [dateHeaderButton addTarget:self action:@selector(didClickMonthHeader) forControlEvents:UIControlEventTouchUpInside];
201 [
self.view addSubview:dateHeaderButton];
203 float fwdMonthButtonLeftEdge =totalFrameSize.width - (dirButtonWidth+4.0);
204 CGRect fwdMonthFrame =CGRectMake(fwdMonthButtonLeftEdge, topOfPageF, dirButtonWidth, buttonHeight);
206 [fwdMonthButton setBackgroundColor:[UIColor whiteColor]];
207 [fwdMonthButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
208 [fwdMonthButton addGradientFace:gradientBandColor];
209 [fwdMonthButton setTitle:@">>" forState:UIControlStateNormal];
210 [fwdMonthButton addTarget:self action:@selector(didClickPageFwd) forControlEvents:UIControlEventTouchUpInside];
211 [
self.view addSubview:fwdMonthButton];
214 topOfPageF += buttonHeight;
218 [calendarView setPreferredWeekStartIndex:0];
219 [calendarView setCalendarDelegate:self];
222 float calendarWidth = totalFrameSize.width-12;
223 float calendarHeight = totalFrameSize.height-12-topOfPageF;
224 CGRect calendarFrame = CGRectMake(6, topOfPageF+6, calendarWidth, totalFrameSize.height-12-topOfPageF);
225 [calendarView setFrame:calendarFrame];
227 float dayCellWidth = calendarWidth/8;
228 float dayCellHeight = calendarHeight/6;
229 [calendarView setDayCellWidth:dayCellWidth];
230 [calendarView setDayCellHeight:dayCellHeight];
231 [calendarView refresh];
232 [
self.view addSubview:calendarView];
instancetype sharedInstance()
UIButton * dateHeaderButton
B2NutritionCalendarView * calendarView
UIButton * fwdMonthButton
Singleton interface to both core and remote data sources.
UIButton * bckMonthButton