Detects mobile phone flip and mobile phone flip
Code:
-(Void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. // listen to the mobile phone direction change event [[NSNotificationCenter defacenter center] addObserver: self selector: @ selector (orientationChanged) name: UIDeviceOrientationDidChangeNotification object: nil];} // processing function-(void) orientationChanged {switch ([[UIDevice currentDevice] orientation]) {case UIDeviceOrientationPortrait: NSLog (@ "portrait"); brea K; case when: NSLog (@ "portraitUpSideDown"); break; case when: NSLog (@ "landscapeLeft"); break; case UIDeviceOrientationLandscapeRight: NSLog (@ "landscapeRight "); break; case UIDeviceOrientationFaceDown: NSLog (@ "facedown !! "); Break; case UIDeviceOrientationFaceUp: NSLog (@" FaceUp "); break; default: break ;}}