Я просто исправил это в своем приложении под iOS 5.1. Это старый вопрос, но я оставляю это здесь для потомков, так как я не видел, чтобы кто-либо другой решал это без применения gobs кода CGAffineTransform и не исправлял реальной проблемы, а это значит, что UIInterfaceOrientation и UIDeviceOrientation не синхронизированы ,
В моем случае мне нужно было только зафиксировать ориентацию, когда я шел из портрета ViewController и только в портретный и ландшафтный ViewController, когда устройство было физически повернуто до перехода.
// The "Interface Orientation" and the "Device Orientation" can become separated in some cases.
// Make sure the view controller only supports the interface orientation for the current device rotation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
int deviceRotation = [[UIDevice currentDevice] orientation];
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
if (deviceRotation == UIDeviceOrientationUnknown ||
deviceRotation == UIDeviceOrientationFaceUp ||
deviceRotation == UIDeviceOrientationFaceDown)
return YES;
if (deviceRotation != interfaceOrientation)
return NO;
else
return YES;
}
Вы возвращаете НЕТ для всех случаев? Ваше мнение должно поддерживать как минимум 1 ориентацию. – skorulis