3
在應用程序啓動時[[UIDevice currentDevice]方向]方法沒有返回正確的值。這是一個API測試版bug嗎?還是有一種新的方法來檢測iOS 8中的方向?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];
}