I'm calling up a UINavigationController and usually allowing it to use any major orientation:
- (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;
}
From there I call a UITableViewController:
myTable = [[SimpleDocViewerTable alloc] initWithFrame:thisFrame];
self = [super initWithRootViewController:myTable];
Where:
@interface SimpleDocViewerTable : UITableViewController {
The table view controller and navigation controller mostly seem integrated correctly. When I push a new page onto the navigation controller, it correctly scrolls right to left, no matter which orientation I'm using:
SimpleDocPageVC *thisVC = [[SimpleDocPageVC alloc] initWithView:docView];
thisVC.title = [[[tableEntries objectAtIndex:indexPath.section]
objectAtIndex:indexPath.row] objectForKey:@"title"];
[self.navigationController pushViewController:thisVC animated:YES];
However, when I exit that pushed page, if the iPhone is in landscape mode, it scrolls bottom to top, rather than right to left.
The popViewController is all taken care of magically within the automatic "开发者_如何学Cback" button that's generated, so it should be doing the right thing ... but doesn't.
Could it be that one of your controllers (SimpleDocViewerTable
, or SimpleDocPageVC
) does not support both orientation in shouldAutorotateToInterfaceOrientation
?
精彩评论