Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

didScrollToDateSegment called twice. #102

Closed
victtavares opened this issue Aug 5, 2016 · 2 comments
Closed

didScrollToDateSegment called twice. #102

victtavares opened this issue Aug 5, 2016 · 2 comments

Comments

@victtavares
Copy link

Hi, The delegate method:

 calendar(calendar: JTAppleCalendarView, didScrollToDateSegmentStartingWithdate startDate: NSDate, endingWithDate endDate: NSDate)

is being called twice on the user scroll. I did some debug and figure out that its being called here:

 public func scrollViewWillEndDragging(scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {

        // Update the date when user lifts finger
        delayRunOnGlobalThread(0.0, qos: QOS_CLASS_USER_INITIATED) { 
            let currentSegmentDates = self.currentCalendarDateSegment()
            delayRunOnMainThread(0.0, closure: { 
                self.delegate?.calendar(self, didScrollToDateSegmentStartingWithdate: currentSegmentDates.startDate, endingWithDate: currentSegmentDates.endDate)
            })
        }

and here:

public func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
        let currentSegmentDates = currentCalendarDateSegment()
        self.delegate?.calendar(self, didScrollToDateSegmentStartingWithdate: currentSegmentDates.startDate, endingWithDate: currentSegmentDates.endDate)
    }

I hope it helps on the fix. :)

@victtavares victtavares changed the title didScrollToDateSegment called Twice. didScrollToDateSegment called twice. Aug 5, 2016
@patchthecode patchthecode self-assigned this Aug 5, 2016
@patchthecode
Copy link
Owner

patchthecode commented Aug 5, 2016

Yes thanks.
I'm currently working on an neat little feature in that section right now.
No worries, i'm already on it.

Thanks much for pointing it out! :)

The enhancement relates to this issue here.

The double calling of the didScroll will be removed soon.

@patchthecode
Copy link
Owner

fixed on master branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants