Possible Duplicate:
iPhone orientation
How to check the orientation of device at any point off time programmatically in iPhone ?
Thank You.
Possible Duplicate:
iPhone orientation
How to check the orientation of device at any point off time programmatically in iPhone ?
Thank You.
Try it.
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
if ( ([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait) )
{
// do something for Portrait mode
}
else if(([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight) || ([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeLeft))
{
// do something for Landscape mode
}