views:

63

answers:

1

in uiresponder ,

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

what's the difference between [event allTouches] and [touches allObject]?

+3  A: 

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.

Thomas Børlum
i still have a question,when i touched at a UISlider in a uivew,and moved the indicator of the UISlider,[touches allObject] and [event allTouches] both couldn't send a responder.why?thank you.
ben