Skip to content

skaffl/objc-CGCalendarView

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

objc-CGCalendarView

A Lightweight Horizontal Calendar/Date Picker inspired by Square's TimesSquare https://github.com/square/objc-TimesSquare

Created for CapitalGene iOS App

Screenshot

Usage

Screenshot

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"];
}
```

Authors

Chen Liang

Credits

License:

Licensed under the MIT license

About

A Lightweight Horizontal Calendar/Date Picker inspired by Square's TimesSquare

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 98.0%
  • Ruby 2.0%