Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

iOS 5 ipad compatibility issues #746

Closed
wants to merge 2 commits into from
Closed

iOS 5 ipad compatibility issues #746

wants to merge 2 commits into from

Conversation

aporat
Copy link
Contributor

@aporat aporat commented Jan 11, 2012

this pull request includes some changes to TTBaseController which solves the issues with UIPopViewController & TTSplitViewController under iOS 5.

The parentViewController function role was under with iOS 5 (http://omegadelta.net/2011/11/04/oh-my-god-they-killed-parentviewcontroller/) which caused issues with TTSplitViewController when the secondary view controller is displayed as a popup view controller.

closes #713

@tonklon
Copy link
Contributor

tonklon commented Jan 11, 2012

Ugh, a lot of cosmetic changes between real fixes. IMHO cosmetics should have their own commit(s).

@aporat
Copy link
Contributor Author

aporat commented Jan 15, 2012

also including #719 bug fix here

@aporat
Copy link
Contributor Author

aporat commented Jan 16, 2012

As I'm no longer using the TTNavigator and the url mapping, I'm not planning on looking at it.
Either merge it as is or close this pull request. as far as i know, these changes work well.

@shenwill
Copy link

A quick fix in TTBaseNavigator.m.
From iOS 5, [uiViewController parentViewController] returns its containing view controller only, no longer returns the presenting view controller (aka. model view controller, the presenter), or split view controller.

///////////////////////////////////////////////////////////////////////////////////////////////////
+ (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*             childController = nil; // The last iterated controller.

  controller = view.viewController;
  while (nil != controller) {

    if ([controller conformsToProtocol:@protocol(TTNavigatorRootContainer)]) {
      container = (id<TTNavigatorRootContainer>)controller;
      break;
    }

    childController = controller;
    controller = childController.parentViewController;

    // From iOS 5, [uiViewController parentViewController] returns its containing view 
    // controller only, no longer returns the presenting view controller (aka. model view  
    // controller, the presenter), or split view controller.
    if (nil == controller
        && [childController respondsToSelector:@selector(presentingViewController)]) {
      controller = childController.presentingViewController;
    }

    if (nil == controller) {
      controller = childController.splitViewController;
    }
  }

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

  return navigator;
}

@jamesgpearce
Copy link
Contributor

Facebook has not maintained or supported Three20 for some time, and we are closing its old and outstanding pull requests.

Many, many thanks for your support of the project. If you have any further questions, please don't hesitate to let me know.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants