开发者

Three20 - TTSplitViewController in portrait mode

开发者 https://www.devze.com 2023-03-28 08:53 出处:网络
I\'m running the TTCatalog project (without modifying it) from the Three20 s开发者_如何学JAVAamples on the iPad.

I'm running the TTCatalog project (without modifying it) from the Three20 s开发者_如何学JAVAamples 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号