Сначала вы должны настроить все ориентации на Поддерживаемой ориентации интерфейса в Xcode Резюме проекта. Затем в AppDelegate:
- (NSUInteger) application: (UIApplication*) application supportedInterfaceOrientationsForWindow: (UIWindow*) window
{
NSUInteger orientations = UIInterfaceOrientationMaskAll;
if (self.window.rootViewController)
{
UIViewController* rootViewController = self.window.rootViewController;
UIViewController* presented;
if ([rootViewController isKindOfClass: [UINavigationController class]])
{
presented = [[(UINavigationController*) rootViewController viewControllers] lastObject];
}
else
{
presented = (UIViewController*) rootViewController;
}
orientations = [presented supportedInterfaceOrientations];
}
return orientations;
}
Тогда в каждом UIViewController:
- (NSUInteger) supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
В какой вам нужен другой ориентации, вы должны изменить от UIInterfaceOrientationMaskPortrait к UIInterfaceOrientationMaskLandscapeLeft или другой.
Спасибо - я добавил этот код, но он, похоже, не изменил ситуацию. Я разрешил все ориентации в интерфейсе в резюме, а затем добавил, как вы сказали, но не сработал ... ничего не пропало? – Omar
Я создал образец проекта. Вы можете проверить его https://github.com/SKrotkih/TestRotations – stosha