I'm looking for a way to get a reliable iPhone orientation.
The best way I've found so far is calling [[UIDevice currentDevice] orientation]. For some reason, it always returns 0 to me - although I called
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
on the app's didFinishLaunching. In addition, I've heard it provides a non-reliable value if the device is flat.
I've also seen that you can access [[UIApplication sharedApplication] statusBarOrientation], but that always returns me 1.
I will mention that although I can't seem to get right rotation, the views ( created by xibs ) all rotate correctly, but I need to check the rotation in code.
Can anybody recommend a reliable way to check this?
Tnx in advance!
EDIT: ok weirdest bug ever - on some views [UIApplication sharedApplication].statusBarOrientation does work, but on some returns always 1.