kvyatkovskys/KVKCalendar

Wrong device orientation

nefch opened this issue · 2 comments

nefch commented

In DayView.swift you are calling if UIDevice.current.orientation.isPortrait { ... } else { ...} .

If an iPad has not been rotated yet, UIDevice.current.orientation returns .unknown. In that case your code behaves like the iPad is in Landscape although it might be in Portrait. Thus the day view looks wrong.

Solution would be to first get the UIInterfaceOrientation (with UIApplication.shared.statusBarOrientation or UIApplication.shared.windows.first?.windowScene?.interfaceOrientation) and then map UIInterfaceOrientation to UIDeviceOrientation.

Hi @nefch!
Thx for the issue. I'll check this case.

nefch commented

Unfortunately this is not fully fixed by #290.

On line 202 in DayView.reloadFrame(_:) there is still this piece of code:
if UIDevice.current.orientation.isPortrait {