UINavigationController中的Back Transition错误+横向方向的UITableViewController

时间:2011-07-11 20:08:52

标签: iphone objective-c ios uitableview uinavigationcontroller

我正在调用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在生成的自动“后退”按钮中神奇地处理,所以它应该做正确的事情......但不是。

1 个答案:

答案 0 :(得分:10)

可能是您的某个控制器(SimpleDocViewerTableSimpleDocPageVC)不支持shouldAutorotateToInterfaceOrientation中的这两个方向吗?