iphonetouchipadiphone-sdk-3.2

Difference between [event allTouches] and [touches allObjects]?


In UIResponder

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

What's the difference between [event allTouches] and [touches allObjects]?


Solution

  • To my understanding it is as follows:

    [event allTouches] returns all touches that are part of the event. Some of those touches might be meant for another UIResponder.

    For instance you might click in two view at the same time and the responder associated with each view will get called with all the touches of the event.

    [touches allObject] only contains touches ment for this responder. And is thus in most cases what you are after.