[Code Note] detects mobile phone flip and code note flip
I. 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];} # pragma-mark-functions // processing function-(void) orientationChanged {switch ([[UIDevice currentDevice] orientation]) {case UIDeviceOrientationPortrait: NSLog (@ "portrait"); break; 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 ;}}