How could I track an event like touch on iPhone screen for 2 seconds. Like in Safari to save image for image added to a UIWebView?
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.
Create an NSTimer with
+scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:in your view’s-touchesBegan:withEvent:method, and cancel it (using-invalidate) in-touchesEnded:withEvent:. If the method its selector points at gets called, then the user held their finger on the view for whatever duration you set the timer’s interval to. Example:Interface (.h):
Implementation (.m):