Friday 3 June 2011

How to get the current orientation on iPhone/iPad


UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];

The UIInterfaceOrientation is an enum:
typedef enum {
  UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait,
  UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
  UIInterfaceOrientationLandscapeLeft      = UIDeviceOrientationLandscapeLeft,
  UIInterfaceOrientationLandscapeRight     = UIDeviceOrientationLandscapeRight
} UIInterfaceOrientation;



No comments:

Post a Comment