Search code examples
ioscocoa-toucheventsuitouchuievent

Why is only one UIEvent created for many separate touches?


I'm learning the touch event mechanism of iOS.

From the documentation I understood that a UIEvent object would be created when first touch down happened, it would live till the last touch up, and it would contain all the UITouch objects created in the period.

But in my testing, I found that there is only one UIEvent object created in a view in whole life of the application, and the number of UITouch objects it contains depends on how many fingers touch.

If you touch with one finger, there would be only one UITouch object created, and the UITouch object would be updated in different phases.

I mean the representation in my testing is different from the description of the documentation: there is only one UIEvent object when many different touches happen.

Why is that? Have I misunderstood something anywhere?


Solution

  • An event is an action or occurrence detected by the program that may be handled by the program. The event could be anything like touch event, motion event or remote-control event. Simply UITouch also is an part of UIEvent. UITouch can generate event which is handled by program. Program sense the touch using event.

    For more detail information you get in following links, http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009541

    http://developer.apple.com/library/ios/#documentation/uikit/reference/UIEvent_Class/Reference/Reference.html

    http://developer.apple.com/library/ios/#documentation/uikit/reference/UITouch_Class/Reference/Reference.html

    http://en.wikipedia.org/wiki/Event_%28computing%29

    I hope it will helpful.