main.m
TapAppDelegate
View
The methods
singleTap
and
doubleTap
of class
View
are called in
touchesEnded:withEvent:
at the end of a single or double tap.
After a two-second delay, the method
noTap
is called to reset the display.
You can’t name a method
double
because
double
is a keyword in this language.
touchesEnded:withEvent:
can’t call
singleTap
as soon as it
has detected a single tap.
After all, the single tap might turn out to be the first tap of a double tap.
We therefore request that a call be made to
singleTap
after a delay of 0.3 seconds.
If a second tap arrives,
we
cancel
this request.
See
Handling
Tap Gestures.
The method
performSelector:withObject:afterDelay:
lets you call the method of your choice,
belonging to the object of your choice,
after the delay (in seconds) of your choice.
For another way to distingush between single and double taps, see here.