在景观朝向中UINavigationController + UITableViewController的反向过渡错误

时间:2022-06-28 21:09:09

I'm calling up a UINavigationController and usually allowing it to use any major orientation:

我打电话给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;
}

From there I call a UITableViewController:

然后我调用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.

但是,当我退出按下的页面时,如果iPhone处于横向模式,它会从底部滚动到顶部,而不是从右到左。

The popViewController is all taken care of magically within the automatic "back" button that's generated, so it should be doing the right thing ... but doesn't.

popViewController在生成的自动“后退”按钮中得到了神奇的处理,所以它应该做正确的事情……但不喜欢。

1 个解决方案

#1


10  

Could it be that one of your controllers (SimpleDocViewerTable, or SimpleDocPageVC) does not support both orientation in shouldAutorotateToInterfaceOrientation?

可能是您的一个控制器(SimpleDocViewerTable,或SimpleDocPageVC)不支持shouldAutorotateToInterfaceOrientation的方向吗?

#1


10  

Could it be that one of your controllers (SimpleDocViewerTable, or SimpleDocPageVC) does not support both orientation in shouldAutorotateToInterfaceOrientation?

可能是您的一个控制器(SimpleDocViewerTable,或SimpleDocPageVC)不支持shouldAutorotateToInterfaceOrientation的方向吗?