Skip to content

Instantly share code, notes, and snippets.

@pchw
Created June 6, 2012 16:04
Show Gist options
  • Save pchw/2882922 to your computer and use it in GitHub Desktop.
Save pchw/2882922 to your computer and use it in GitHub Desktop.
call resignFirstResponder for nil
class NilClass
def method_missing(method, *args, &block)
if method.to_s == "resignFirstResponder"
return nil
else
super
end
end
end
# send resignFirstResponder with nil check to all UIView
views.each do |view|
view.resignFirstResponder
end
nil.becomeFirstResponder # NoMethodException as ever
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment