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

Calendar disrupts on orientation change #468

Closed
harshvishu opened this issue Nov 3, 2016 · 10 comments
Closed

Calendar disrupts on orientation change #468

harshvishu opened this issue Nov 3, 2016 · 10 comments

Comments

@harshvishu
Copy link

harshvishu commented Nov 3, 2016

Issue
When rotating device (iPad). The calendar changes the current month randomly.
This might help, mostly the months are : May 2007, 2008.

The selected dates are also changed. But the calendar resets to the original state when taped/ interacted upon.

steps to reproduce
Using FSCalendar from InterfaceBuilder. Rotate the device

Device modal and version
iPad , OS version 10.1

Xcode version: Xcode 8.1 beta
FSCalendar version: pod 'FSCalendar'

@WenchaoD
Copy link
Owner

WenchaoD commented Nov 4, 2016

@harshvishu Does it happen in StoryboardExample in you iPad? And which modal of the iPad BTW.

@harshvishu
Copy link
Author

Yes It is happening in storyboard but I've not tried building it through code.
And the model for iPad is : iPad Air 2, os: 10.0.2

@muthuselvamlms
Copy link

I too got the same issue. Any one has answer for this?

@h-bomb
Copy link

h-bomb commented Jan 9, 2017

I reproduced the issue in the current master branch, SwiftExample, on iPad Pro 9.3 and 10.2 simulators and an iPad Air 2 10.0.2 device. Here is a video demonstrating the issue. Note when transitioning from portrait to landscape that the Month/Year header changes from the current month/year (January 2017) to May 2001.

@harshvishu, could you change the title to reflect the actual issue, i.e., the the month / year changes to the wrong month / year on rotation? Thanks.

@WenchaoD
Copy link
Owner

Hi @h-bomb . Thanks for the demo video. The issue in the SwiftExample has been fixed.

@h-bomb
Copy link

h-bomb commented Jan 11, 2017

@WenchaoD: Does this work with multitasking on supported iPads (e.g., iPad Air 2, iPad Pro)? When in the slide over menu, I am not able to switch to a split view with SwiftExample to test.

I'm using the following work-around in my view controller, but it's not the best work-around since you can see the month/year header and days scrolling as you rotate or switch to multitasking mode (which looks pretty bad) - still working on it:

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
    super.viewWillTransition(to: size, with: coordinator)
    coordinator.animate(alongsideTransition: {_ in
        self.calendar.select(self.calendar.selectedDate)
    }, completion: nil)
}

@h-bomb
Copy link

h-bomb commented Jan 13, 2017

@WenchaoD: I was able to fix everything in my view controller. Just an FYI, I'm still running off of my forked branch (based on your 2.4.0 version.)

@WenchaoD
Copy link
Owner

@h-bomb Can you create a new issue along with an example for the slide-menu problem?

@h-bomb
Copy link

h-bomb commented Jan 14, 2017

@WenchaoD: No problem: #546

@alekseilobankov
Copy link

@WenchaoD: Does this work with multitasking on supported iPads (e.g., iPad Air 2, iPad Pro)? When in the slide over menu, I am not able to switch to a split view with SwiftExample to test.

I'm using the following work-around in my view controller, but it's not the best work-around since you can see the month/year header and days scrolling as you rotate or switch to multitasking mode (which looks pretty bad) - still working on it:

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
    super.viewWillTransition(to: size, with: coordinator)
    coordinator.animate(alongsideTransition: {_ in
        self.calendar.select(self.calendar.selectedDate)
    }, completion: nil)
}

I still have the same issue. After rotating the device to landscape, calendar selects some random date few years ago. Was it really fixed?
The problem occurred when using FSCalendar as an arranged subview of a stackview. I change stackview axis on device rotation.

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

No branches or pull requests

5 participants