if (![UIDevice currentDevice].generatesDeviceOrientationNotifications) { [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; } [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(handleDeviceOrientationChange:) name:UIDeviceOrientationDidChangeNotification object:nil]; //设备偏向改变的处理 - (void)handleDeviceOrientationChange:(NSNotification *)notification{ UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation; switch (ddeviceOrientation) { case UIDeviceOrientationFaceUp: NSLog(@"屏幕朝上平躺"); break; case UIDeviceOrientationFaceDown: NSLog(@"屏幕手下平躺"); break; case UIDeviceOrientationUnknown: NSLog(@"未知偏向"); break; case UIDeviceOrientationLandscapeLeft: NSLog(@"屏幕向左横置"); break; case UIDeviceOrientationLandscapeRight: NSLog(@"屏幕向右橫置"); break;
推荐阅读
2017,最受欢迎的 15 大 Python 库有哪些?
近年来,Python 在数据科学行业扮演着越来越重要的角色。是以,我根据比来的应用体验,在本文中列出了对数据科学家、工程师们最有效的那些库。因为这些库都开源了,我们大年夜Github上惹人>>>详细阅读
本文标题:代码处理iOS的横竖屏旋转
地址:http://www.17bianji.com/lsqh/36388.html
1/2 1