iOS判斷手機方向改變
ios開發-判斷手機反轉
//監聽手機方向改變事件 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged) name:UIDeviceOrientationDidChangeNotification object:nil]; //處理函數 -(void) orientationChanged { switch ([[UIDevice currentDevice]orientation]) { case UIDeviceOrientationPortrait: NSLog(@"portrait"); break; case UIDeviceOrientationPortraitUpsideDown: NSLog(@"portraitUpSideDown"); break; case UIDeviceOrientationLandscapeLeft: NSLog(@"landscapeLeft"); break; case UIDeviceOrientationLandscapeRight: NSLog(@"landscapeRight"); break; case UIDeviceOrientationFaceDown: NSLog(@"facedown!!"); break; case UIDeviceOrientationFaceUp: NSLog(@"FaceUp"); break; default: break; } }
本文由用戶 iosbg 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!