Skip to content

Instantly share code, notes, and snippets.

@DanLuchi
Created March 17, 2014 14:24
Show Gist options
  • Save DanLuchi/9600114 to your computer and use it in GitHub Desktop.
Save DanLuchi/9600114 to your computer and use it in GitHub Desktop.
uiview_helper.rb
class UIView
def controller
controller_for_view(self)
end
def controller_for_view(view)
controller = UIViewController.viewControllerForView view
if controller
controller
elsif view.superview
controller_for_view view.superview
else
nil
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment