在应用启动时,方法[[UIDevice currentDevice] orientation]没有返回正确的值。这是API beta版本的错误还是iOS 8中有一种新的检测方向的方法?
以下是我在应用启动时使用的代码。
UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice] orientation];
if (deviceOrientation == UIDeviceOrientationPortrait){
}
else if (deviceOrientation == UIDeviceOrientationLandscapeLeft){
[self orientationLandscapeLeftAdjust];
}
else if (deviceOrientation == UIDeviceOrientationLandscapeRight){
[self orientationLandscapeRightAdjust];
}
else if (deviceOrientation == UIDeviceOrientationPortraitUpsideDown){
[self orientationPortraitUpSideDownAdjust];
}