Вы, вероятно, захотите прикусить пулю и позволить вашему проекту принять несколько ориентаций на самом высоком уровне, а затем решить для каждого UIViewController, какие ориентации поддерживаются.Это позволит фреймворкам выполнять большую часть работы за вас (всегда хорошая идея).
В контроллере каждого представления переопределите этот метод:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
Вы захотитевернуть YES
для любой ориентации, которую вы хотите, чтобы представление поддерживало.
Четыре параметра параметра interfaceOrientation:
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
Так что для вашего случая вам понадобится представлениеКонтроллер хостинга вашего представления и панели вкладок для поддержки всех ориентаций.Вот как должна выглядеть функция:
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return YES;
}
Но для дополнительной информации, если вы хотите поддерживать только альбомную ориентацию влево и книжную ориентацию вверх ногами, функция будет выглядеть следующим образом:
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}