Three20 - 纵向模式下的TTSplitViewController

时间:2011-08-15 13:56:30

标签: ios ipad uiviewcontroller three20 uisplitviewcontroller

我在iPad上的Three20样本中运行TTCatalog项目(不修改它)。

我注意到,当应用程序处于纵向模式时,我无法通过单击左上角的Bar按钮显示的Pop over更改“Detail”视图控制器(或rightNavigator)内容项目

如果我将设备旋转到横向,我可以选择leftNavigator个项目,并在rightNavigator上查看相应的内容。

如何使用TTSplitViewController

在纵向方向上获得相同的效果

由于

更新

只有使用在iOS 4.3上运行的iOS 5.0才会出现此问题。

1 个答案:

答案 0 :(得分:0)

我昨天遇到了同样的问题。

我在TTBaseNavigator.m中写了一条路径到three20 trunk,用以下内容替换了navigatorForView:view

+ (TTBaseNavigator*)navigatorForView:(UIView*)view {
  // If this is called with a UIBarButtonItem, we can't traverse a view hierarchy to find the
  // navigator, return the global navigator as a fallback.
  if (![view isKindOfClass:[UIView class]]) {
    return [TTBaseNavigator globalNavigator];
  }

  id<TTNavigatorRootContainer>  container = nil;
  UIViewController*             controller = nil;      // The iterator.
  UIViewController*             pcontroller = nil;      // The iterator.
  UIViewController*             childController = nil; // The last iterated controller.

  for (controller = view.viewController;
       nil != controller;
       controller = controller.parentViewController) {
    for (pcontroller = controller;
         nil != pcontroller;
         pcontroller = pcontroller.splitViewController) {
      if ([pcontroller conformsToProtocol:@protocol(TTNavigatorRootContainer)]) {
        container = (id<TTNavigatorRootContainer>)pcontroller;
        break;
      }
    }
    if ([controller conformsToProtocol:@protocol(TTNavigatorRootContainer)]) {
      container = (id<TTNavigatorRootContainer>)controller;
      break;
    }

    childController = controller;
  }

  TTBaseNavigator* navigator = [container getNavigatorForController:childController];
  if (nil == navigator) {
    navigator = [TTBaseNavigator globalNavigator];
  }

  return navigator;
}

今天早上我在github上发现了拉取请求。我觉得它比我好。您可以在此处找到它:https://github.com/facebook/three20/pull/746

希望这个帮助