From 44ed60685032da602a58e65c447c848d7c41834b Mon Sep 17 00:00:00 2001 From: powfulhong <970087302@qq.com> Date: Sun, 6 Sep 2015 17:58:49 +0800 Subject: [PATCH 1/2] fix wrong direction when selected different month --- THCalendarDatePicker/THDatePickerViewController.m | 3 ++- THCalendarDatePickerExample/Podfile.lock | 6 +++--- .../THCalendarDatePickerExample/TestViewController.m | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/THCalendarDatePicker/THDatePickerViewController.m b/THCalendarDatePicker/THDatePickerViewController.m index 331bd0c..046f53c 100755 --- a/THCalendarDatePicker/THDatePickerViewController.m +++ b/THCalendarDatePicker/THDatePickerViewController.m @@ -421,10 +421,11 @@ - (void)dateDayTapped:(THDateDay *)dateDay { [self.currentDay setSelected:NO]; [dateDay setSelected:YES]; BOOL dateInDifferentMonth = ![self dateInCurrentMonth:dateDay.date]; + NSDate *firstOfCurrentMonth = self.firstOfCurrentMonth; [self setInternalDate:dateDay.date]; [self setCurrentDay:dateDay]; if (dateInDifferentMonth) { - [self slideTransitionViewInDirection:[dateDay.date timeIntervalSinceDate:self.firstOfCurrentMonth]>0 ? UISwipeGestureRecognizerDirectionRight : UISwipeGestureRecognizerDirectionLeft]; + [self slideTransitionViewInDirection:[dateDay.date timeIntervalSinceDate:firstOfCurrentMonth]<0 ? UISwipeGestureRecognizerDirectionRight : UISwipeGestureRecognizerDirectionLeft]; } if ([self.delegate respondsToSelector:@selector(datePicker:selectedDate:)]) { [self.delegate datePicker:self selectedDate:dateDay.date]; diff --git a/THCalendarDatePickerExample/Podfile.lock b/THCalendarDatePickerExample/Podfile.lock index da6ee69..9a4d35f 100644 --- a/THCalendarDatePickerExample/Podfile.lock +++ b/THCalendarDatePickerExample/Podfile.lock @@ -8,10 +8,10 @@ DEPENDENCIES: EXTERNAL SOURCES: THCalendarDatePicker: - :path: "../" + :path: ../ SPEC CHECKSUMS: KNSemiModalViewController: 8c0056377714b5170c52c65977d540200405411f - THCalendarDatePicker: 5d2b396b690796c45c30925dd0c23943141dbac6 + THCalendarDatePicker: 2e481afccfabe1199509872e726e4f8604e27a0c -COCOAPODS: 0.38.2 +COCOAPODS: 0.39.0.beta.3 diff --git a/THCalendarDatePickerExample/THCalendarDatePickerExample/TestViewController.m b/THCalendarDatePickerExample/THCalendarDatePickerExample/TestViewController.m index 07b337b..6341093 100644 --- a/THCalendarDatePickerExample/THCalendarDatePickerExample/TestViewController.m +++ b/THCalendarDatePickerExample/THCalendarDatePickerExample/TestViewController.m @@ -40,7 +40,7 @@ - (IBAction)touchedButton:(id)sender { //[self.datePicker setDisableFutureSelection:NO]; [self.datePicker setDaysInHistorySelection:1]; [self.datePicker setDaysInFutureSelection:0]; - [self.datePicker setDateTimeZoneWithName:@"UTC"]; +// [self.datePicker setDateTimeZoneWithName:@"UTC"]; //[self.datePicker setAutoCloseCancelDelay:5.0]; [self.datePicker setSelectedBackgroundColor:[UIColor colorWithRed:125/255.0 green:208/255.0 blue:0/255.0 alpha:1.0]]; [self.datePicker setCurrentDateColor:[UIColor colorWithRed:242/255.0 green:121/255.0 blue:53/255.0 alpha:1.0]]; From 1e23606dbcfced433efc53e3e77dcb54169f4e2b Mon Sep 17 00:00:00 2001 From: powfulhong <970087302@qq.com> Date: Mon, 7 Sep 2015 10:58:54 +0800 Subject: [PATCH 2/2] fix bug:when selected-date and pre-selected-date is in the same view, the pre-selected-date's text color is still black --- THCalendarDatePicker/THDatePickerViewController.m | 1 + 1 file changed, 1 insertion(+) diff --git a/THCalendarDatePicker/THDatePickerViewController.m b/THCalendarDatePicker/THDatePickerViewController.m index 046f53c..32c9ae0 100755 --- a/THCalendarDatePicker/THDatePickerViewController.m +++ b/THCalendarDatePicker/THDatePickerViewController.m @@ -419,6 +419,7 @@ - (BOOL)setDateTimeZoneWithName:(NSString *)name { - (void)dateDayTapped:(THDateDay *)dateDay { if (!_internalDate || [_internalDate timeIntervalSinceDate:dateDay.date] || _allowSelectionOfSelectedDate) { // new date selected [self.currentDay setSelected:NO]; + [self.currentDay setLightText:![self dateInCurrentMonth:self.currentDay.date]]; [dateDay setSelected:YES]; BOOL dateInDifferentMonth = ![self dateInCurrentMonth:dateDay.date]; NSDate *firstOfCurrentMonth = self.firstOfCurrentMonth;