From b81158dfd7600e1d31143be4fbfba32af2187253 Mon Sep 17 00:00:00 2001 From: JayT Date: Mon, 19 Jun 2017 15:38:59 -0700 Subject: [PATCH] re-Added concept of anchor dates on reloadData again --- Sources/JTAppleCalendarLayout.swift | 1 + Sources/UserInteractionFunctions.swift | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/JTAppleCalendarLayout.swift b/Sources/JTAppleCalendarLayout.swift index b3bb88bf..77c43677 100644 --- a/Sources/JTAppleCalendarLayout.swift +++ b/Sources/JTAppleCalendarLayout.swift @@ -727,5 +727,6 @@ class JTAppleCalendarLayout: UICollectionViewLayout, JTAppleCalendarLayoutProtoc contentHeight = 0 contentWidth = 0 stride = 0 + firstContentOffsetWasSet = false } } diff --git a/Sources/UserInteractionFunctions.swift b/Sources/UserInteractionFunctions.swift index b52379f0..cf21d28c 100644 --- a/Sources/UserInteractionFunctions.swift +++ b/Sources/UserInteractionFunctions.swift @@ -159,7 +159,7 @@ extension JTAppleCalendarView { /// - Parameter animation: Scroll is animated if this is set to true /// - Parameter completionHandler: This closure will run after /// the reload is complete - public func reloadData(completionHandler: (() -> Void)? = nil) { + public func reloadData(withanchor date: Date? = nil, completionHandler: (() -> Void)? = nil) { if isScrollInProgress || isReloadDataInProgress { delayedExecutionClosure.append {[unowned self] in self.reloadData(completionHandler: completionHandler) @@ -168,6 +168,7 @@ extension JTAppleCalendarView { } isReloadDataInProgress = true + initialScrollDate = date let selectedDates = self.selectedDates let layoutNeedsUpdating = reloadDelegateDataSource()