Let’s say I have a button.. how can I distinguish between single click and double click if they both call my IBAction? Is there a way to know which event caused the call, or to set up different actions, one for each type of event?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
EDIT:
In Cocoa, afaik, each control has a kind of “fixed” event it responds to. To manage double clicks, you should override the methods
mouseUpormouseDown, where you will get the information about the number of clicks.OLD ANSWER:
You can define multiple IBActions associated to the same control by displaying the actions tab for your control in Interface Builder and then connecting the proper event type to your controller action. Have a look at the attached image, hope it makes clearer. It displays the events available for button.