【问题标题】:Back Transition Wrong in UINavigationController + UITableViewController in Landscape Orientation横向 UINavigationController + UITableViewController 中的返回转换错误
【发布时间】: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


    【解决方案1】:

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

    【讨论】:

    • 我遇到了同样的问题,您的评论帮助我解决了它!谢谢
    • 我只是想确认一下塞尔吉奥的回答。有同样的问题,在检查了 shouldAutorotateToInterfaceOrientation 方法后,其中一个控制器实际上没有 shouldAutorotateToInterfaceOrientation 方法。
    猜你喜欢
    • 2011-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多