Skip to content

Don't stop looking for the view controller when it's a UINavigationController#237

Merged
twerth merged 1 commit into
masterfrom
current_view_controller_fix
Apr 13, 2015
Merged

Don't stop looking for the view controller when it's a UINavigationController#237
twerth merged 1 commit into
masterfrom
current_view_controller_fix

Conversation

@markrickert
Copy link
Copy Markdown
Member

I needed to put a UITabBarController inside a UINavigationController (I know, NOT recommended by Apple, but I had to do it nonetheless).

This fixes the stylesheet not being able to be set because when it found a UINavigationController as the root_view_controller, it just gave up. I'm asking the method to keep searching till it gets an actual UIViewController and not blindly trust that the visibleViewController is a UIViewController.

An alternative so that we don't have to recurse one more time would be something like this:

when UINavigationController
  if root_view_controller.visibleViewController.is_a?(UIViewController)
    root_view_controller.visibleViewController
  else
    current_view_controller(root_view_controller.visibleViewController)
  end
when UITabBarController
# ...

…ntroller

I needed to put a UITablBarController inside a UINavigationController (I know, NOT recommended by Apple, but I had to do it nonetheless).

This fixes the stylesheet not being able to be set because when it found a UINavigationController as the root_view_controller, it just gave up. I'm asking the method to keep searching till it gets an actual UIViewController and not blindly trust that the visibleViewController is a UIViewController.
twerth added a commit that referenced this pull request Apr 13, 2015
Don't stop looking for the view controller when it's a UINavigationController
@twerth twerth merged commit 61c177b into master Apr 13, 2015
@GantMan GantMan deleted the current_view_controller_fix branch April 15, 2015 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants