Method: UIView#controller

Defined in:
lib/sugarcube-uikit/uiview.rb

#controllerObject

returns the nearest nextResponder instance that is a UIViewController. Goes up the responder chain until the nextResponder is a UIViewController subclass, or returns nil if none is found.



54
55
56
57
58
59
60
61
62
# File 'lib/sugarcube-uikit/uiview.rb', line 54

def controller
  if nextResponder && nextResponder.is_a?(UIViewController)
    nextResponder
  elsif nextResponder
    nextResponder.controller
  else
    nil
  end
end