Saturday, July 11, 2009

iPhone™ and iPod®touch Programming: Handling Touch Interactions and Events Sample

An essential part of any Web 2.0 application is the ability to respond to events triggered by the user or by a condition that occurs on the client: the clicking of a button, the pressing of a key, the scrolling of a window. While the user interacts with an HTML element, the entire document, or the browser window, JavaScript serves as the watchful eye behind the scenes that monitors all of this activity taking place and fires off events as they occur.
With their touch screen interface, iPhone and iPod touch are all about direct interactivity with the user. As a result, you would expect any Mobile Safari application you create to be able to handle the variety of finger taps, flicks, swipes, and pinches that a user naturally performs as they interact with their mobile device. However, because of the current capabilities of Mobile Safari browser, you have to work with these interactions differently from what you might expect.


How iPhone and iPod touch Handle Events
When working with touch interactions and events for iPhone and iPod touch, keep in mind that the finger is not a mouse. As a result, the traditional event model that web developers are so used to working with does not always apply in this new context. This is both good news and bad news for the application developer. The good news is that much of the touch interaction that iPhone and iPod touch are famous for is built right into Mobile Safari. As a result, you do not need to write any code to handle the basic touch interactions of the user. Flick-scrolling, pinching and unpinching, and one-finger scrolling are those sorts of user inputs that come for free. The bad news is that the developer is greatly constrained in his or her ability to work with the full suite of JavaScript events and override built-in behavior. As a result, certain user interactions that have become a staple to web developers now are impossible to utilize or require tricky, dumbed-down workarounds.

Source : wiley.com

Download Manual Book

0 comments:

Post a Comment | Feed



 
^

Powered by Bloggerblogger addicted por UsuárioCompulsivo
original Washed Denim por Darren Delaye
Creative Commons License