Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'hotfix-openURLFromButton-crash'

Closes #463.
  • Loading branch information...
commit 2ce7b125903edf3eee6b5ffe359b4e8c1bc83a84 2 parents 8faa4fd + d87c92d
@jverkoey jverkoey authored
View
6 src/Three20UINavigator/Headers/TTBaseNavigator.h
@@ -164,6 +164,12 @@
* with the top-most controller that contains this view that /isn't/ the container.
* If getNavigatorForController: returns a navigator, this navigator is returned.
* Otherwise, the global navigator is returned.
+ *
+ * If the given view is not, in fact, a view, which is the case if a UIBarButtonItem is passed,
+ * returns the global navigator via [TTBaseNavigator globalNavigator].
+ *
+ * If you need to use a specific navigator for UIBarButtonItem, handle the button tap
+ * yourself and use navigatorForView: on an actual view in the controller.
*/
+ (TTBaseNavigator*)navigatorForView:(UIView*)view;
View
6 src/Three20UINavigator/Sources/TTBaseNavigator.m
@@ -127,6 +127,12 @@ + (void)setGlobalNavigator:(TTBaseNavigator*)navigator {
///////////////////////////////////////////////////////////////////////////////////////////////////
+ (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.
Please sign in to comment.
Something went wrong with that request. Please try again.