IOS Orientation Change
I recently had to find and use the orientation on an IOS project so i used [[UIDevice currentDevice] orientation]. This worked most of the time but I noticed there were times that it did not detect the orientation correctly.
Sometimes it would return zero when the actual device was in landscape. After some searches and a few tests I found out that it only happened when the app was started in landscape mode and never rotated before the orientation was read.
So, it would seem that until the first rotation that orientation will always be zero. From the tests I found that using [UIApplication sharedApplication].statusBarOrientation is much more accurate.
Use
[UIApplication sharedApplication].statusBarOrientation
to find the orienation of an IOS device.
Post new comment