iOS屏幕旋转

来源:互联网 发布:java多线程视频教程 编辑:程序博客网 时间:2024/06/05 03:28

- (void)viewDidLoad {

    [superviewDidLoad];

    // Do any additional setup after loading the view, typically from a nib.

    

    

// 检测设备方向改变

    [[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(test:)name:UIDeviceOrientationDidChangeNotificationobject:nil];

    

}

- (void)test:(NSNotification *)noti{

    switch ([UIDevicecurrentDevice].orientation) {

        caseUIDeviceOrientationPortraitNSLog(@"正常"); break;

        caseUIDeviceOrientationLandscapeLeftNSLog(@"向左"); break;

        caseUIDeviceOrientationLandscapeRightNSLog(@"向右"); break;


        default:

            break;

    }

}

0 0
原创粉丝点击