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

AT UIResponder

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

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

+3
source share
2 answers

As I understand it, it looks like this:

[event allTouches]returns all touches that are part of the event. Some of these touches may be for another UIResponder.

For example, you can click two views at the same time, and the responder associated with each view will be called with all touches of the event.

[touches allObject]contains only touches for this responder. And so, in most cases, you find yourself after.

+6
source

allTouches. ( , , ).

for (UITouch* touch in [[event allTouches]allObjects]) //loops through the list of all the current touches

touches - , .

for (UITouch* touch in [touches allObjects]) //loops through the list of all changed touches for this event.

, touchesBegan:withEvent:

  • touches, [event allTouches] .
  • touches, UITouch, , [event allTouches] UITouch , .
  • , touches UITouch 2 , [event allTouches] 4 UITouch.

touchesEnded:withEvent:

  • , touches UITouch, , [event allTouches] 4 UITouch, , .
+3

Source: https://habr.com/ru/post/1755893/


All Articles