How to check the orientation of device programmatically in iPhone? [duplicate]

Here are macros UIDeviceOrientationIsLandscape and UIDeviceOrientationIsPortrait

so rather checking separately you can do it like this …

   if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation))
    {
         // code for landscape orientation      
    }

OR

    if (UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation))
    {
         // code for Portrait orientation       
    }

Leave a Comment