JTAppleCalendar icon indicating copy to clipboard operation
JTAppleCalendar copied to clipboard

reloadData animation paramter

Open soorinpark opened this issue 8 years ago • 11 comments

IMPORTANT - BEFORE CREATING YOUR ISSUE PLEASE READ THE FOLLOWING:

  1. PLEASE STATE THE VERSION NUMBER you are using. v7.1.5
  2. Are you using the latest version of JTAppleCalendar? Latest version is currently 7.1.5 yes
  3. PROVIDE ENOUGH INPORMATION SO I CAN RECREATE THE PROBLEM.

Hi,

In the UserInteractionFunctions, there is:

/// Reloads the data on the calendar view. Scroll delegates are not
//  triggered with this function.
/// - Parameter date: An anchordate that the calendar will
///                   scroll to after reload completes
/// - 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(withanchor date: Date? = nil, completionHandler: (() -> Void)? = nil) {

but it doesn't seem like animation is a valid parameter for reloadData anymore.

Thanks for your awesome work btw!

soorinpark avatar Mar 16 '18 16:03 soorinpark

Related to this... Providing an anchordate doesn't cause the calendar to scroll to that date (animated or not).

So this does not work as it should, according to the docs:

calendarView.reloadData(withanchor: anchorDate, completionHandler: nil)

A temporary workaround I'm using is to scroll to the anchordate in the completion handler (which will do an animated scroll):

calendarView.reloadData(withanchor: nil) { self.calendarView.scrollToDate(anchorDate) }

loydbrahn avatar Mar 16 '18 20:03 loydbrahn

hmm. maybe I broke something. Will check this out soon.

patchthecode avatar Mar 17 '18 01:03 patchthecode

I made an update on master branch. See this issue for instruction on testing with master branch code to see if your issue is resolved -> https://github.com/patchthecode/JTAppleCalendar/issues/746

As you have said, do this for animation ->

calendarView.reloadData() { self.calendarView.scrollToDate(anchorDate) }

However, the following was broken, but now it is fixed. It will do a reloadData without animation.

calendarView.reloadData(withanchor: anchorDate)

and yes @soorinpark the animation parameter was removed. In its place we now have a completion handler in which you can scroll to date as shown above.

patchthecode avatar Mar 31 '18 22:03 patchthecode

@patchthecode Ok that's what I figured! Can I suggest you remove it from the comments for accuracy? Thanks :)

soorinpark avatar May 08 '18 14:05 soorinpark

@soorinpark cool. closing this issue now. I if you got any more questions, just let me know. We leave comments here on github so leave a record to help other people. More comments = more help.

cheers 🍻

patchthecode avatar May 15 '18 16:05 patchthecode

@patchthecode Is this available in the latest version on Cocoapods?

I'm using the following but still seeing an animation with the dates sliding in from the side...

calendarView.reloadData(withanchor: selectedDate)

jun-08-2018 12-10-50

antsmo avatar Jun 08 '18 11:06 antsmo

@MyGuySi are you using master branch code?

https://github.com/patchthecode/JTAppleCalendar/wiki/Common-Questions

patchthecode avatar Jun 08 '18 11:06 patchthecode

If yes, is it possible you can send me that purple sample app? [email protected]

patchthecode avatar Jun 08 '18 11:06 patchthecode

Ah probably not, sorry I didn't see that. I'll update my Podfile and see if that fixes it 👍

antsmo avatar Jun 08 '18 11:06 antsmo

@patchthecode Yep that's fixed it, guess that fix isn't on Cocoapods yet then. Thanks for the quick response!

antsmo avatar Jun 08 '18 11:06 antsmo

@MyGuySi Youre right.

its not released yet. I will soon though, once i get the some free time. Have a good one.

patchthecode avatar Jun 08 '18 12:06 patchthecode