UIDeviceOrientation 是机器硬件的当前旋转方向 这个你只能取值 不能设置
UIInterfaceOrientation 是你程序界面的当前旋转方向 这个可以设置
UIDeviceOrientation oriention = [UIDevice currentDevice].orientation;
UIInterfaceOrientation interfaceOriention = (UIInterfaceOrientation)oriention;
switch (interfaceOriention) {
case UIInterfaceOrientationUnknown:
NSLog(@"位置方向");
break;
case UIInterfaceOrientationPortrait:
NSLog(@"第0个旋转方向---电池栏在上");
[self shrinkScreenButtonClick];
break;
case UIInterfaceOrientationPortraitUpsideDown:
NSLog(@"第3个旋转方向---电池栏在下");
[self shrinkScreenButtonClick];
break;
case UIInterfaceOrientationLandscapeLeft:
[self fullScreenButtonClickRight];
NSLog(@"第2个旋转方向---电池栏在右");
break;
case UIInterfaceOrientationLandscapeRight:
[self fullScreenButtonClick];
NSLog(@"第1个旋转方向---电池栏在左");
break;
default:
break;
}
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation