Three20 - 纵向模式下的 TTSplitViewController

发布于 2024-11-29 18:41:00 字数 383 浏览 0 评论 0原文

我正在 iPad 上运行 Three20 示例中的 TTCatalog 项目(不修改它)。

我注意到,当应用程序处于纵向模式时,我无法通过单击左上角的栏按钮显示的弹出窗口更改“详细信息”视图控制器(或 rightNavigator)内容物品。

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

如何使用 TTSplitViewController 在纵向上实现相同的效果?

谢谢

更新

这个问题仅在使用 iOS 5.0 时出现,在 iOS 4.3 上运行没问题。

I'm running the TTCatalog project (without modifying it) from the Three20 samples on the iPad.

I noticed that when the App is in the Portrait mode I can't change the "Detail" View controller (or the rightNavigator) content through the Pop over that is showed by clicking in the top left Bar button item.

If I rotate the device to the Landscape orientation, I can select any of the leftNavigator items and see their corresponding content on the rightNavigator.

How can I achieve the same effect in the portrait orientation using the TTSplitViewController?

Thanks

UPDATE

This issue only happens when using the iOS 5.0, running on iOS 4.3 is OK.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ヅ她的身影、若隐若现 2024-12-06 18:41:00

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

我在 TTBaseNavigator.m 中写了一条到 Three20 主干的路径,用以下内容替换 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/third20/pull/746

希望有帮助

I encountered the same problem yesterday.

I wrote a path to the three20 trunk in TTBaseNavigator.m replacing navigatorForView:view with the following

+ (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;
}

This morning I found out a pull request on github fixing it. I think it is better than mine. You can find it here : https://github.com/facebook/three20/pull/746

Hope this help

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文