Jtapplecalendar: The layout bug occurs when I rotate a device. (version 7.1.6)

Created on 22 Sep 2018  Â·  8Comments  Â·  Source: patchthecode/JTAppleCalendar

The bug happens on both my own project and the iOS example project in this library (version 7.1.6).
I used Xcode10, and iPad Pro (9.7-inch, simulator) & iPhone8 (simulator) for testing. This bug does not happen in the previous version (7.1.5).

Please take a look at the iOS example project in this library. @patchthecode

Screenshots (FYI)

[1] Rotate from Landscape to Portrait

iPad

simulator screen shot - ipad pro 9 7-inch - 2018-09-23 at 04 14 07

simulator screen shot - ipad pro 9 7-inch - 2018-09-23 at 04 00 00

iPhone

simulator screen shot - iphone 8 - 2018-09-23 at 04 17 50

simulator screen shot - iphone 8 - 2018-09-23 at 04 17 55

[2] Rotate from Portrait to Landscape

iPad

simulator screen shot - ipad pro 9 7-inch - 2018-09-23 at 03 59 37

simulator screen shot - ipad pro 9 7-inch - 2018-09-23 at 03 59 41

iPhone

simulator screen shot - iphone 8 - 2018-09-23 at 04 17 43

simulator screen shot - iphone 8 - 2018-09-23 at 04 17 46

Most helpful comment

@gsuthor
yes. but what is the code you have in that viewWillTransition function?

Can you try this in there?

    override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
        let ds = calendarView.visibleDates()
        calendarView.viewWillTransition(to: .zero, with: coordinator, anchorDate: ds.monthDates.first?.date)
    }

All 8 comments

I have the same Problem when switching from portrait to landscape on iPad with Version 7.1.6

will take a look

can you paste me the code you used on rotation?
@gsuthor
@mock123

I used just constraints with a height constraint for the Calendar View that is changed in viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator). I also tried calenderView.layoutSubviews but it doesn't work.

In Version 7.1.5 it was working.

@gsuthor
yes. but what is the code you have in that viewWillTransition function?

Can you try this in there?

    override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
        let ds = calendarView.visibleDates()
        calendarView.viewWillTransition(to: .zero, with: coordinator, anchorDate: ds.monthDates.first?.date)
    }

With the code above, it worked like a charm for me! @patchthecode

Yes it worked with the code above. Big Thanks @patchthecode

cool.closing issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oddpandadesign picture oddpandadesign  Â·  5Comments

prahaladm picture prahaladm  Â·  3Comments

PedroAnibarro1 picture PedroAnibarro1  Â·  5Comments

programus picture programus  Â·  5Comments

Fatalution picture Fatalution  Â·  3Comments