New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Apr 13, 2015

Conversation

Projects
None yet
2 participants
@markrickert
Member

markrickert commented Apr 12, 2015

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
# ...
Don't stop looking for the view controller when it's a UINavigationCo…
…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

Merge pull request #237 from infinitered/current_view_controller_fix
Don't stop looking for the view controller when it's a UINavigationController

@twerth twerth merged commit 61c177b into master Apr 13, 2015

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@GantMan GantMan deleted the current_view_controller_fix branch Apr 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment