Reputation: 1
I am navigating from a controller to another controller(which invokes device camera), but found that the orientation of the second controller is returned by iOS as portrait, even though I am in portrait mode.
Inititally I was on portrait mode while I was in the first controller, then tilted the device to landscape mode and navigated to the next controller(which invoked camera).
I want to perform some activity only when the orientation is landscape, so i check this condition, but the control never comes into this even when I have the device in landscape.
if(orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight)
{
// perform an activity
}
Upvotes: 0
Views: 113
Reputation: 11333
You can get the accurate orientation by using [[UIApplication sharedApplication] statusBarOrientation]
property. Click here for a quick comparison.
Upvotes: 1