2

I read in the UIResponder class reference:

There are two general kinds of events: touch events and motion events.

The primary event-handling methods for touches are touchesBegan:withEvent:, touchesMoved:withEvent:, touchesEnded:withEvent:, and touchesCancelled:withEvent: ...

but another article, the Event Handling Guide for iOS says:

The first responder is the first view in a window to receive the following type of events and messages: Motion events, Remote-control events, Action messages, Editing-menu messages

So I was confused that the second note says the responder handles only four events -- touch events were not included -- whereas the first note says the responder handles touch event.

Please let me know what I am misunderstanding.

Community
  • 1
  • 1
hiall
  • 89
  • 5

1 Answers1

3

Only one responder at a time is the first responder. This responder gets the first look at the four event types you quoted. Touch events always go to the touched view first. This is explained just a few paragraphs after the paragraph you quoted:

When the system delivers a touch event, it first sends it to a specific view. For touch events, that view is the one returned by hitTest:withEvent:; for “shaking”-motion events, remote-control events, action messages, and editing-menu messages, that view is the first responder.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848
  • i think the first quote says as responder is the view because of view is also subclass of UIResponder. so the UIResponder of touchesBegan:withEvent: just use a result from UIView of hittest. am i right? – hiall Nov 01 '11 at 07:37