How to get event from IBAction method
I have hooked up a UITextField to an action method for a series of events. So that I can check what a particular event is, I used the sender's: event: method. However, I am currently at a loss as to how to determine what the actual event that caused this method is. What's the secret?
source to share
The "event" is the one that gets passed to your action method, but I'm guessing your real question is which one UIControlEvents
triggered the action. UIEvent
and are UIControlEvents
not related. The target / action template contains UIEvent
. If you want to handle different things UIControlEvents
differently, you must implement different actions for them.
Remember the target / action mechanism matters UIResponder
. UIControlEvents
associated with UIControl
.
source to share