Particularly, being able to send custom actions to the first responder that will bubble up to anyone else that might be interested: [[UIApplication sharedApplication] sendAction: @selector(commandToSend) to: nil from: self forEvent: nil]
.
Or less custom actions with:
[[UIApplication sharedApplication] sendAction: @selector(resignFirstResponder) to: nil from: self forEvent: nil]
I'd like to know – is there a way to test before hand if a particular action from a particular sender would be handled if it were sent now? An obvious use for this would be to enable and disable buttons that send actions dependent on whether that action is going to be handled at the moment.
If you happen to know the first responder, I think you can do [aResponder targetForAction: @selector(methodYouWantToSend) withSender: selfOrSomethingElse]
, and check whether the answer is nil or not. But there doesn't seem to be a an equivalent method to UIApplication
's sendAction:…
that will automatically start at the first responder and work up.
aResponder
if it can handle a method. It doesn't ask the responder chain if it can handle a method. – Wandis