From f85ea5c420e3dbfd78ec0469e2e5bdfac0b714b9 Mon Sep 17 00:00:00 2001 From: "E. Maloney" Date: Mon, 23 Mar 2015 00:53:20 -0400 Subject: [PATCH 1/3] Add 8 new behavior attributes for custom colors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • CLCalendarPastDayNumberTextColor — The day-of-month number text color for dates in the past • CLCalendarFutureDayNumberTextColor – The day-of-month number text color for dates in the future • CLCalendarCurrentDayNumberTextColor — The day-of-month number text color for today • CLCalendarSelectedDayNumberTextColor — The day-of-month number text color for the selected day when that date is not today • CLCalendarSelectedCurrentDayNumberTextColor — The day-of-month number text color for the selected day when that date is today • CLCalendarCurrentDayNumberBackgroundColor — The background color to use for the highlight circle behind the current day when that date isn't selected • CLCalendarSelectedDayNumberBackgroundColor — The background color to use for the highlight circle behind the selected day when that date is not today • CLCalendarSelectedCurrentDayNumberBackgroundColor — The background color to use for the highlight circle behind the selected day when that date is today --- .../CLWeeklyCalendarView.h | 8 +++ .../CLWeeklyCalendarView.m | 55 ++++++++++++++++++- .../DailyCalendarView.h | 9 +++ .../DailyCalendarView.m | 15 ++--- 4 files changed, 77 insertions(+), 10 deletions(-) diff --git a/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.h b/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.h index 62bb9f2..fa0c6d5 100644 --- a/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.h +++ b/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.h @@ -12,6 +12,14 @@ // Keys for customize the calendar behavior extern NSString *const CLCalendarWeekStartDay; //The Day of weekStart from 1 - 7 - Default: 1 extern NSString *const CLCalendarDayTitleTextColor; //Day Title text color, Mon, Tue, etc label text color +extern NSString *const CLCalendarPastDayNumberTextColor; //Day number text color for dates in the past +extern NSString *const CLCalendarFutureDayNumberTextColor; //Day number text color for dates in the future +extern NSString *const CLCalendarCurrentDayNumberTextColor; //Day number text color for today +extern NSString *const CLCalendarSelectedDayNumberTextColor; //Day number text color for the selected day +extern NSString *const CLCalendarSelectedCurrentDayNumberTextColor; //Day number text color when today is selected +extern NSString *const CLCalendarCurrentDayNumberBackgroundColor; //Day number background color for today when not selected +extern NSString *const CLCalendarSelectedDayNumberBackgroundColor; //Day number background color for selected day +extern NSString *const CLCalendarSelectedCurrentDayNumberBackgroundColor; //Day number background color when today is selected extern NSString *const CLCalendarSelectedDatePrintFormat; //Selected Date print format, - Default: @"EEE, d MMM yyyy" extern NSString *const CLCalendarSelectedDatePrintColor; //Selected Date print text color -Default: [UIColor whiteColor] extern NSString *const CLCalendarSelectedDatePrintFontSize; //Selected Date print font size - Default : 13.f diff --git a/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.m b/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.m index 3f9ddc5..1e09c65 100644 --- a/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.m +++ b/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.m @@ -36,6 +36,14 @@ //Attribute Keys NSString *const CLCalendarWeekStartDay = @"CLCalendarWeekStartDay"; NSString *const CLCalendarDayTitleTextColor = @"CLCalendarDayTitleTextColor"; +NSString *const CLCalendarPastDayNumberTextColor = @"CLCalendarPastDayNumberTextColor"; +NSString *const CLCalendarFutureDayNumberTextColor = @"CLCalendarFutureDayNumberTextColor"; +NSString *const CLCalendarCurrentDayNumberTextColor = @"CLCalendarCurrentDayNumberTextColor"; +NSString *const CLCalendarSelectedDayNumberTextColor = @"CLCalendarSelectedDayNumberTextColor"; +NSString *const CLCalendarSelectedCurrentDayNumberTextColor = @"CLCalendarSelectedCurrentDayNumberTextColor"; +NSString *const CLCalendarCurrentDayNumberBackgroundColor = @"CLCalendarCurrentDayNumberBackgroundColor"; +NSString *const CLCalendarSelectedDayNumberBackgroundColor = @"CLCalendarSelectedDayNumberBackgroundColor"; +NSString *const CLCalendarSelectedCurrentDayNumberBackgroundColor = @"CLCalendarSelectedCurrentDayNumberBackgroundColor"; NSString *const CLCalendarSelectedDatePrintFormat = @"CLCalendarSelectedDatePrintFormat"; NSString *const CLCalendarSelectedDatePrintColor = @"CLCalendarSelectedDatePrintColor"; NSString *const CLCalendarSelectedDatePrintFontSize = @"CLCalendarSelectedDatePrintFontSize"; @@ -44,6 +52,14 @@ //Default Values static NSInteger const CLCalendarWeekStartDayDefault = 1; static NSInteger const CLCalendarDayTitleTextColorDefault = 0xC2E8FF; +static NSInteger const CLCalendarPastDayNumberTextColorDefault = 0x7BD1FF; +static NSInteger const CLCalendarFutureDayNumberTextColorDefault = 0xFFFFFF; +static NSInteger const CLCalendarCurrentDayNumberTextColorDefault = 0xFFFFFF; +static NSInteger const CLCalendarSelectedDayNumberTextColorDefault = 0x34A1FF; +static NSInteger const CLCalendarSelectedCurrentDayNumberTextColorDefault = 0x0081c1; +static NSInteger const CLCalendarCurrentDayNumberBackgroundColorDefault = 0x0081c1; +static NSInteger const CLCalendarSelectedDayNumberBackgroundColorDefault = 0xffffff; +static NSInteger const CLCalendarSelectedCurrentDayNumberBackgroundColorDefault = 0xffffff; static NSString* const CLCalendarSelectedDatePrintFormatDefault = @"EEE, d MMM yyyy"; static float const CLCalendarSelectedDatePrintFontSizeDefault = 13.f; @@ -63,6 +79,14 @@ @interface CLWeeklyCalendarView() Date: Mon, 23 Mar 2015 01:09:25 -0400 Subject: [PATCH 2/3] fix iOS 8 deprecations --- .../CLWeeklyCalendarViewSourceCode/Misc/NSDate+CL.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/Misc/NSDate+CL.m b/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/Misc/NSDate+CL.m index 6eb5ed2..f0f1b3c 100644 --- a/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/Misc/NSDate+CL.m +++ b/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/Misc/NSDate+CL.m @@ -23,8 +23,8 @@ -(NSDate *)getWeekStartDate: (NSInteger)weekStartIndex -(NSNumber *)getWeekDay { - NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; - NSDateComponents *comps = [gregorian components:NSWeekdayCalendarUnit fromDate:self]; + NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; + NSDateComponents *comps = [gregorian components:NSCalendarUnitWeekday fromDate:self]; return [NSNumber numberWithInteger:([comps weekday] - 1)]; } @@ -62,7 +62,7 @@ -(NSString *)getDateOfMonth } - (NSDate*)midnightDate { - return [[NSCalendar currentCalendar] dateFromComponents:[[NSCalendar currentCalendar] components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:self]]; + return [[NSCalendar currentCalendar] dateFromComponents:[[NSCalendar currentCalendar] components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:self]]; } -(BOOL) isSameDateWith: (NSDate *)dt{ return ([[self midnightDate] isEqualToDate: [dt midnightDate]])?YES:NO; From 93b1967d2eef69fca832b42d82e530ad218263fb Mon Sep 17 00:00:00 2001 From: "E. Maloney" Date: Mon, 23 Mar 2015 01:16:14 -0400 Subject: [PATCH 3/3] Revert "Add 8 new behavior attributes for custom colors" This reverts commit f85ea5c420e3dbfd78ec0469e2e5bdfac0b714b9. --- .../CLWeeklyCalendarView.h | 8 --- .../CLWeeklyCalendarView.m | 55 +------------------ .../DailyCalendarView.h | 9 --- .../DailyCalendarView.m | 15 +++-- 4 files changed, 10 insertions(+), 77 deletions(-) diff --git a/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.h b/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.h index fa0c6d5..62bb9f2 100644 --- a/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.h +++ b/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.h @@ -12,14 +12,6 @@ // Keys for customize the calendar behavior extern NSString *const CLCalendarWeekStartDay; //The Day of weekStart from 1 - 7 - Default: 1 extern NSString *const CLCalendarDayTitleTextColor; //Day Title text color, Mon, Tue, etc label text color -extern NSString *const CLCalendarPastDayNumberTextColor; //Day number text color for dates in the past -extern NSString *const CLCalendarFutureDayNumberTextColor; //Day number text color for dates in the future -extern NSString *const CLCalendarCurrentDayNumberTextColor; //Day number text color for today -extern NSString *const CLCalendarSelectedDayNumberTextColor; //Day number text color for the selected day -extern NSString *const CLCalendarSelectedCurrentDayNumberTextColor; //Day number text color when today is selected -extern NSString *const CLCalendarCurrentDayNumberBackgroundColor; //Day number background color for today when not selected -extern NSString *const CLCalendarSelectedDayNumberBackgroundColor; //Day number background color for selected day -extern NSString *const CLCalendarSelectedCurrentDayNumberBackgroundColor; //Day number background color when today is selected extern NSString *const CLCalendarSelectedDatePrintFormat; //Selected Date print format, - Default: @"EEE, d MMM yyyy" extern NSString *const CLCalendarSelectedDatePrintColor; //Selected Date print text color -Default: [UIColor whiteColor] extern NSString *const CLCalendarSelectedDatePrintFontSize; //Selected Date print font size - Default : 13.f diff --git a/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.m b/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.m index 1e09c65..3f9ddc5 100644 --- a/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.m +++ b/CLWeeklyCalendarView/CLWeeklyCalendarViewSourceCode/CLWeeklyCalendarView.m @@ -36,14 +36,6 @@ //Attribute Keys NSString *const CLCalendarWeekStartDay = @"CLCalendarWeekStartDay"; NSString *const CLCalendarDayTitleTextColor = @"CLCalendarDayTitleTextColor"; -NSString *const CLCalendarPastDayNumberTextColor = @"CLCalendarPastDayNumberTextColor"; -NSString *const CLCalendarFutureDayNumberTextColor = @"CLCalendarFutureDayNumberTextColor"; -NSString *const CLCalendarCurrentDayNumberTextColor = @"CLCalendarCurrentDayNumberTextColor"; -NSString *const CLCalendarSelectedDayNumberTextColor = @"CLCalendarSelectedDayNumberTextColor"; -NSString *const CLCalendarSelectedCurrentDayNumberTextColor = @"CLCalendarSelectedCurrentDayNumberTextColor"; -NSString *const CLCalendarCurrentDayNumberBackgroundColor = @"CLCalendarCurrentDayNumberBackgroundColor"; -NSString *const CLCalendarSelectedDayNumberBackgroundColor = @"CLCalendarSelectedDayNumberBackgroundColor"; -NSString *const CLCalendarSelectedCurrentDayNumberBackgroundColor = @"CLCalendarSelectedCurrentDayNumberBackgroundColor"; NSString *const CLCalendarSelectedDatePrintFormat = @"CLCalendarSelectedDatePrintFormat"; NSString *const CLCalendarSelectedDatePrintColor = @"CLCalendarSelectedDatePrintColor"; NSString *const CLCalendarSelectedDatePrintFontSize = @"CLCalendarSelectedDatePrintFontSize"; @@ -52,14 +44,6 @@ //Default Values static NSInteger const CLCalendarWeekStartDayDefault = 1; static NSInteger const CLCalendarDayTitleTextColorDefault = 0xC2E8FF; -static NSInteger const CLCalendarPastDayNumberTextColorDefault = 0x7BD1FF; -static NSInteger const CLCalendarFutureDayNumberTextColorDefault = 0xFFFFFF; -static NSInteger const CLCalendarCurrentDayNumberTextColorDefault = 0xFFFFFF; -static NSInteger const CLCalendarSelectedDayNumberTextColorDefault = 0x34A1FF; -static NSInteger const CLCalendarSelectedCurrentDayNumberTextColorDefault = 0x0081c1; -static NSInteger const CLCalendarCurrentDayNumberBackgroundColorDefault = 0x0081c1; -static NSInteger const CLCalendarSelectedDayNumberBackgroundColorDefault = 0xffffff; -static NSInteger const CLCalendarSelectedCurrentDayNumberBackgroundColorDefault = 0xffffff; static NSString* const CLCalendarSelectedDatePrintFormatDefault = @"EEE, d MMM yyyy"; static float const CLCalendarSelectedDatePrintFontSizeDefault = 13.f; @@ -79,14 +63,6 @@ @interface CLWeeklyCalendarView()