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

move(to: ) forcing timeline view to 12:00 am #211

Open
3 tasks done
drouston opened this issue Jun 20, 2019 · 5 comments
Open
3 tasks done

move(to: ) forcing timeline view to 12:00 am #211

drouston opened this issue Jun 20, 2019 · 5 comments
Labels

Comments

@drouston
Copy link

New Issue Checklist

Issue Description

When I call dayView.state?.move(to: ) the subsequent timeline view resets to 12:00 am. I'd like for the position of the scroll view not to change, just as in the provided example. I am calling from within a delegate function of another library for a calendar cell selection. The scrollTo(hour24: ) and scrollToFirstEventIfNeeded() functions will work but only after the reset to 12:00 am.

I'm using just a DayView rather than a DayViewController. I've removed the extraneous code (I think...).

Thanks.

Code I'm using with CalendarKit
    @IBOutlet weak var dayView: DayView!

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.dayView.isHeaderViewVisible = false
        
        self.dayView.dataSource = self
        self.dayView.delegate = self
        self.dayView.reloadData()
        
    }

    override func viewDidAppear(_ animated: Bool) {
       
       self.dayView.scrollToFirstEventIfNeeded() //This scroll func works great
        
    }

    func calendar(didSelectDate date: Date) {
        
        self.dayView.state?.move(to: date)
        
    }

Result I am trying to achieve

See behavior in the iOS example.

@drouston
Copy link
Author

Quick clarification: the iOS example has this behavior when

autoScrollToFirstEvent = false

Thanks.

@richardtop richardtop added the bug label Jun 21, 2019
@drouston
Copy link
Author

drouston commented Jun 26, 2019

Updates:

  • I set
dayView.isHeaderViewVisible = true

and attempted to tap the dates in the header view. I observed the same behavior with the day view resetting to 0:00 hrs.

  • I've removed and reinstalled the pods for CalendarKit and dependencies for a clean install. No change.

  • I attempted to modify the date in move(to:) to include hour and minute components equal to the previous date. No change.

The swipe gesture on the day view maintains the same time as the previous page view. My guess at this point is this has something to do either with using the DayView as a subview or that I've setup the view controller in Interface Builder.

@drouston
Copy link
Author

drouston commented Jun 27, 2019

I was able to recreate the problem in a new project workspace with a clean install. My steps were only to have the ViewController class inherit from DayViewController. See code snippet for all lines of code in ViewController.swift and see the gif for behavior. The swipe gestures work fine and actually have a bit of nuance to the resulting page views; it seems to remember the vertical scroll position of the last view if swiped straight back to it. My best guess with the date selection at this point is it is related to the IB storyboard implementation of the paging scroll view. Maybe it is just starting at the top of the frame with a newly drawn view? It would be nice to resolve this as I would like to use CalendarKit in IB with related views for the calendars and events.

I'm a bit new to coding, and posting on github, so apologies if I'm using the wrong terms. I've probably hit the limit of my time commitment to this issue so I may not update anymore, or at least for a while. Any help is appreciated! 🙏🏼 thanks.

import UIKit
import CalendarKit

class ViewController: DayViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
    }


}

VagueAcademicEland-size_restricted

edits: removed requestData() from code as it was not necessary, added swipe gesture observations

@drouston
Copy link
Author

drouston commented Aug 2, 2019

Hello @richardtop, just following up on this one. Any news?

Thanks.

@richardtop
Copy link
Owner

This is a known bug in the library. Thank you for reporting it.

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

No branches or pull requests

2 participants