Thursday, August 8, 2013

StatusBarOrientation doesn't give correct answer

StatusBarOrientation doesn't give correct answer

I'm checking if the device is in landscape mode or in portrait when a
button is pressed with this code:
orientation = [[UIApplication sharedApplication]statusBarOrientation];
- (void)buttonclick
{
if (orientation == UIInterfaceOrientationPortrait)
{
NSLog(@"port");
}
else
{
NSLog(@"Land");
}
}

In this case it logs land, even thought the simulator is in portrait mode.
What's wrong?

No comments:

Post a Comment