FSCalendar icon indicating copy to clipboard operation
FSCalendar copied to clipboard

Date cells and month/year get messed up when changing orientation from portrait to landscape and vice versa

Open mxp7064 opened this issue 6 years ago • 9 comments

Date cells and month/year get messed up when changing orientation from portrait to landscape and vice versa. The cells misalign and month/year goes to random like year 2035 or 2006. After that when I change orientation again everything goes back to normal, very strange bug! Integration method: cocoapods Steps to reproduce: Change orinetation from landscape to portrait and vice versa ipad mini 2 and iphone 6 both ios 12.1 Xcode version. 10.1 FSCalendar version: multiple versions have this issue, I tried 2.6, 2.7.9 and 2.8.0

Screenshots: I start with for example 11/11/2018 date selected (current day by default) and I change orientation and get this: 45879644_726276941052574_8620385416207400960_n

I managed to make a temporary workaround which seems to work only for version 2.7.9: override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { super.viewWillTransition(to: size, with: coordinator) coordinator.animate(alongsideTransition: {_ in self.calendar.reloadData() }, completion: nil) }

It looks almost the same as this unsolved issue: https://github.com/WenchaoD/FSCalendar/issues/434

mxp7064 avatar Nov 11 '18 17:11 mxp7064

Can you check if it is working with my change? https://github.com/WenchaoD/FSCalendar/pull/766 And if it is working you can support it to be merged.

asam139 avatar Nov 19 '18 12:11 asam139

Same problem here.

frasza avatar Dec 18 '18 14:12 frasza

@mxp7064 i faced this issue you just set aspect to fit content mode for CalenderView.

VDPurohit avatar Dec 25 '18 09:12 VDPurohit

this still seems to be happening even with change 766, @VDPurohit can you post your code you used to fix it ? not sure what view to set for content mode. Thanks! @asam139 it seems to only be an issue with iphone x (xs) screens, i tried on an emulator on an iphone 6s and it worked fine, maybe it has something to do with safe areas?

ajprala avatar Dec 26 '18 21:12 ajprala

Just started using this calendar today, and had the same thing happen. Year jumped to 2035 in May. Rotated the iPad and it jumped back.

hooji avatar Jan 09 '19 02:01 hooji

@ajprala set content mode of calendar view:-select calendar view->Inside Attribute inspector -> content mode set to scale to fill.

VDPurohit avatar Feb 18 '19 05:02 VDPurohit

Anyone news on this? I'm getting the same thing with the 2035 date as well. I've tried both content mode suggestions.

keithmichelson avatar Jun 08 '19 00:06 keithmichelson

having the same issue anybody find some solution for that?

asar1 avatar Sep 04 '19 08:09 asar1

pull request If a contributor does not merge the pull request then just checkout this fork and update your podfile to use local path:

pod 'FSCalendar', :path => '../FSCalendar'

jonpittock avatar Jul 10 '23 15:07 jonpittock