kvyatkovskys / KVKCalendar

A most fully customization calendar for Apple platforms 📅

Home Page:https://kvyatkovskys.github.io/KVKCalendar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong device orientation

nefch opened this issue · comments

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.

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 {