Is it possible to detect UI orientation is locked or not currently? If so, how can I do that?
I want to do something with gravity sensor when only UI orientation is not locked.
Is it possible to detect UI orientation is locked or not currently? If so, how can I do that?
I want to do something with gravity sensor when only UI orientation is not locked.
Not possible unfortunately, the lock is handled by the OS and is transparent to the app.
Why not try calling the shouldAutorotate method and see what BOOL value is returned?
I haven't tried looking for the UIOrientation lock. But off the top of my head, this is how I'd try.
if([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft])
NSLog(@"Rotates LandscapeLeft");
if([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight])
NSLog(@"Rotates LandscapeRight");
if([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait])
NSLog(@"Rotates Portrait");
if([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortraitUpsideDown])
NSLog(@"Rotates PortraitUpsideDown");
Hopefully this solves your problem.