Я вызываю UINavigationController и обычно позволяю ему использовать любую основную ориентацию:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
// return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
BOOL isAllowed;
if ([allowedOrientations isEqualToString:@"portrait"]) {
isAllowed = (interfaceOrientation == UIInterfaceOrientationPortrait ||
interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
} else if ([allowedOrientations isEqualToString:@"landscape"]) {
isAllowed = (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
} else {
isAllowed = YES;
}
return isAllowed;
}
Оттуда я вызываю UITableViewController:
myTable = [[SimpleDocViewerTable alloc] initWithFrame:thisFrame];
self = [super initWithRootViewController:myTable];
Где:
@interface SimpleDocViewerTable : UITableViewController {
Контроллер табличного представления и контроллер навигации в большинстве случаев выглядят правильно. Когда я помещаю новую страницу в контроллер навигации, она правильно прокручивается справа налево, независимо от того, какую ориентацию я использую:
SimpleDocPageVC *thisVC = [[SimpleDocPageVC alloc] initWithView:docView];
thisVC.title = [[[tableEntries objectAtIndex:indexPath.section]
objectAtIndex:indexPath.row] objectForKey:@"title"];
[self.navigationController pushViewController:thisVC animated:YES];
Однако, когда я выхожу из этой нажатой страницы, если iPhone находится в альбомном режиме, он прокручивается снизу вверх, а не справа налево.
Все функции popViewController позаботились о волшебстве в сгенерированной автоматической кнопке «назад», поэтому он должен делать правильные вещи ... но не делает.