Question

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?

Was it helpful?

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.

OTHER TIPS

I run into the same issue. It really confuses me that the UIEvent object with the same memory address appears again and again --. According to my understanding, each time a multi-touch sequence happens, a UIEvent will be created to represent it. I tend to think this way: Each time there only be one multi-touch sequence occuring, so only one UIEvent object can represent all of them through the whole life of the app. ^^

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top