If you have used elements like UIButton, UIImageView and you want to find out whether user tapped once or twice on it then you can do following and solve the problem very easily !
1. Create a subclass of UIButton or UIImageView whatever it is, in its implementation class you can define UITapGestureRecognizer methods like following:
Then one of the following methods will be executed whenever a touch event is generated by user.You need to write these methods in the same file as above .
And your work is finished here now. You can just create an object of the class you have defined above and enjoy the single tap / double tap work like charm ... you dont need to code the hell out to recognise the single or double tap now !!
1. Create a subclass of UIButton or UIImageView whatever it is, in its implementation class you can define UITapGestureRecognizer methods like following:
Then one of the following methods will be executed whenever a touch event is generated by user.You need to write these methods in the same file as above .
And your work is finished here now. You can just create an object of the class you have defined above and enjoy the single tap / double tap work like charm ... you dont need to code the hell out to recognise the single or double tap now !!
No comments:
Post a Comment