I need to get device orientation from ViewController. I can not be based on :
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
since it sometimes returns an unknown orientation (for example, when the device is in the table).
I just need to know in which orientation my current UIView is displayed (is it a landscape on the left or right). I do not need to update this value when the orientation changes, I just want to know when I ask about it. Only some links are view.orientation;). Is there something that will help me? I read the UIView documentation, found a link to UIWindow, but nothing that could help me.
source
share