【发布时间】:2011-10-03 02:37:27
【问题描述】:
我正在调用 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 在生成的自动“后退”按钮中得到了神奇的处理,所以它应该做正确的事情......但没有。
【问题讨论】:
标签: iphone objective-c ios uitableview uinavigationcontroller