From fe6578132c850be4841a55bf2e111384db402f2a Mon Sep 17 00:00:00 2001 From: WenchaoD Date: Mon, 6 Mar 2017 18:47:55 +0800 Subject: [PATCH 1/6] Remove unnecessary lines --- FSCalendar/FSCalendar.m | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/FSCalendar/FSCalendar.m b/FSCalendar/FSCalendar.m index ed81e04..76a3261 100644 --- a/FSCalendar/FSCalendar.m +++ b/FSCalendar/FSCalendar.m @@ -366,7 +366,6 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) { _collectionView.frame = _daysContainer.bounds; } - [_collectionViewLayout invalidateLayout]; _topBorder.frame = CGRectMake(0, -1, self.fs_width, 1); _bottomBorder.frame = CGRectMake(0, self.fs_height, self.fs_width, 1); @@ -1257,17 +1256,11 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) { } } - } else { - if (self.hasValidateVisibleLayout) { - [_collectionViewLayout layoutAttributesForElementsInRect:_collectionView.bounds]; - CGRect headerFrame = [_collectionViewLayout layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionHeader atIndexPath:[NSIndexPath indexPathForItem:0 inSection:scrollOffset]].frame; - CGPoint targetOffset = CGPointMake(0, MIN(headerFrame.origin.y,MAX(0,_collectionViewLayout.collectionViewContentSize.height-_collectionView.fs_bottom))); - [_collectionView setContentOffset:targetOffset animated:animated]; - } else { - _currentPage = date; - [self setNeedsLayout]; - } - + } else if (self.hasValidateVisibleLayout) { + [_collectionViewLayout layoutAttributesForElementsInRect:_collectionView.bounds]; + CGRect headerFrame = [_collectionViewLayout layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionHeader atIndexPath:[NSIndexPath indexPathForItem:0 inSection:scrollOffset]].frame; + CGPoint targetOffset = CGPointMake(0, MIN(headerFrame.origin.y,MAX(0,_collectionViewLayout.collectionViewContentSize.height-_collectionView.fs_bottom))); + [_collectionView setContentOffset:targetOffset animated:animated]; } if (!animated) { self.calendarHeaderView.scrollOffset = scrollOffset; @@ -1636,7 +1629,6 @@ void FSCalendarRunLoopCallback(CFRunLoopObserverRef observer, CFRunLoopActivity } } [cell configureAppearance]; - } - (void)deselectCounterpartDate:(NSDate *)date From 38c46b140870b1094aaae2933961b006331b0b36 Mon Sep 17 00:00:00 2001 From: WenchaoD Date: Mon, 6 Mar 2017 18:48:33 +0800 Subject: [PATCH 2/6] Protect calculated indexPath from invalidate section --- FSCalendar/FSCalendarCalculator.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FSCalendar/FSCalendarCalculator.m b/FSCalendar/FSCalendarCalculator.m index 0d7cffe..fa98a81 100644 --- a/FSCalendar/FSCalendarCalculator.m +++ b/FSCalendar/FSCalendarCalculator.m @@ -153,7 +153,7 @@ break; } } - if (item < 0) { + if (item < 0 || section < 0) { return nil; } NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:section]; From c4a828a2a0a28810f7dd7499b754d42f36ded1e6 Mon Sep 17 00:00:00 2001 From: WenchaoD Date: Thu, 9 Mar 2017 15:55:38 +0800 Subject: [PATCH 3/6] =?UTF-8?q?Remove=20=E2=80=9Cunrecognized=20selector?= =?UTF-8?q?=E2=80=9D=20issue=20in=20use=20don=E2=80=99t=20implement=20?= =?UTF-8?q?=E2=80=9C-calendar:boundingRectWillChange:animated:=E2=80=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FSCalendar/FSCalendarTransitionCoordinator.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FSCalendar/FSCalendarTransitionCoordinator.m b/FSCalendar/FSCalendarTransitionCoordinator.m index 14d4489..03d880a 100644 --- a/FSCalendar/FSCalendarTransitionCoordinator.m +++ b/FSCalendar/FSCalendarTransitionCoordinator.m @@ -553,7 +553,7 @@ self.calendar.bottomBorder.fs_top = CGRectGetMaxY(targetBounds); self.calendar.contentView.fs_height = CGRectGetHeight(targetBounds)-self.calendar.scopeHandle.fs_height; self.calendar.daysContainer.fs_height = CGRectGetHeight(targetBounds)-self.calendar.preferredHeaderHeight-self.calendar.preferredWeekdayHeight-self.calendar.scopeHandle.fs_height; - [self.calendar.delegate calendar:self.calendar boundingRectWillChange:targetBounds animated:YES]; + [[self.calendar valueForKey:@"delegateProxy"] calendar:self.calendar boundingRectWillChange:targetBounds animated:animated]; } - (void)performForwardTransition:(FSCalendarTransition)transition fromProgress:(CGFloat)progress From 45654a05bdb5ee67a7a0bb4ee21569bcfabe1637 Mon Sep 17 00:00:00 2001 From: WenchaoD Date: Thu, 9 Mar 2017 18:19:41 +0800 Subject: [PATCH 4/6] Present alert controller in example if user denied calendar permission. --- Example-Objc/FullScreenExampleViewController.m | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Example-Objc/FullScreenExampleViewController.m b/Example-Objc/FullScreenExampleViewController.m index 607b049..b709375 100644 --- a/Example-Objc/FullScreenExampleViewController.m +++ b/Example-Objc/FullScreenExampleViewController.m @@ -258,11 +258,9 @@ NS_ASSUME_NONNULL_END } else { // Alert - UIAlertController *alertController = [[UIAlertController alloc] init]; - alertController.title = @"Error"; - alertController.message = @"Permission of calendar is required for fetching events."; + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Permission Error" message:@"Permission of calendar is required for fetching events." preferredStyle:UIAlertControllerStyleAlert]; [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]]; - + [self presentViewController:alertController animated:YES completion:nil]; } }]; From 6b2f86bfb646c29fed7741c531e8f540627d9370 Mon Sep 17 00:00:00 2001 From: WenchaoD Date: Thu, 9 Mar 2017 18:21:31 +0800 Subject: [PATCH 5/6] Bump version. --- FSCalendar.podspec | 2 +- FSCalendar/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FSCalendar.podspec b/FSCalendar.podspec index edb18eb..31d7208 100644 --- a/FSCalendar.podspec +++ b/FSCalendar.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "FSCalendar" - s.version = "2.7.3" + s.version = "2.7.4" s.summary = "A superiorly awesome iOS7+ calendar control, compatible with Objective-C and Swift." s.homepage = "https://github.com/WenchaoD/FSCalendar" diff --git a/FSCalendar/Info.plist b/FSCalendar/Info.plist index 35be4d4..cde9fd1 100644 --- a/FSCalendar/Info.plist +++ b/FSCalendar/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.7.3 + 2.7.4 CFBundleSignature ???? CFBundleVersion From 52a105722eb38dafd78dbe9c4ac8c406949cd60c Mon Sep 17 00:00:00 2001 From: WenchaoD Date: Wed, 15 Mar 2017 18:04:14 +0800 Subject: [PATCH 6/6] Fix issue #621 --- FSCalendar/FSCalendar.m | 1 + 1 file changed, 1 insertion(+) diff --git a/FSCalendar/FSCalendar.m b/FSCalendar/FSCalendar.m index 76a3261..3da4e66 100644 --- a/FSCalendar/FSCalendar.m +++ b/FSCalendar/FSCalendar.m @@ -1224,6 +1224,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) { - (void)handleScopeGesture:(UIPanGestureRecognizer *)sender { + if (self.floatingMode) return; [self.transitionCoordinator handleScopeGesture:sender]; }