Search code examples
iphonecounttaps

iPhone count finger taps and time between taps


I'm pretty new to iPhone programming, so I'm looking for any pointers (no pun intended), links, search terms, etc. on how to make a very simple app that counts how many times one finger touches the screen and how long between each tap.

Thanks for any help, I know this resembles a lame question seeing as how I have really accomplished anything yet.

rd42


Solution

  • In touchesBegan, use:

    NSSet *allTouches = [event allTouches];
    int tapCount = [allTouches count];
    

    to retrieve the tap count.

    You would then need to save the timestamp of the first tap, and find the difference between the next tap in order to get the time elapsed between them.