A Lightweight Horizontal Calendar/Date Picker inspired by Square's TimesSquare https://github.com/square/objc-TimesSquare
Created for CapitalGene iOS App
import CGCalendarView.h and CGCalendarCell.h
```objective-c
- (void)setupCalendarView
{
// initalize calendarView with frame
self.calendarView = [[CGCalendarView alloc] initWithFrame:CGRectMake(0, 20, 320, CG_CALENDAR_VIEW_HEIGHT)];
// use a global NSCalendar
self.calendarView.calendar = calendar;
// Set the background color
self.calendarView.backgroundColor = [UIColor lightGrayColor];
// Set the RowCellClass
self.calendarView.rowCellClass = [CGCalendarCell class];
// The beginning date
self.calendarView.firstDate = [NSDate dateWithTimeIntervalSinceNow: -60 * 60 * 24 * 30];
// The end date
self.calendarView.lastDate = [NSDate dateWithTimeIntervalSinceNow:60 * 60 * 24 * 180];
// didSelectDate delegate
self.calendarView.delegate = self;
// Add the calendarView as a subview
[self.view addSubview:self.calendarView];
// Select Today
self.calendarView.selectedDate = [NSDate date];
// Prepare a dateformatter for displaying the selected
// date
self.DF = [[NSDateFormatter alloc] init];
[self.DF setDateFormat:@"yyyy-MM-dd"];
}
```
Chen Liang
- Inspired by https://github.com/square/objc-TimesSquare
- UIImage+Additions, Piotr Bernad
- UIView+ViewHelpers, Nathan Mock
Licensed under the MIT license