导航

iPhone/iPad上的手势定义及XCode模拟器

Posted on 2012-06-14 00:25  SamWei  阅读(1073)  评论(0编辑  收藏  举报

      Apple提供的《iOS human interface guidelines》对于手势(gestures)的定义是:人们使用特定的手指动作来操作基于iOS设备的独特的多触点界面。当你把一个手指放在iPhone/iPad的屏幕上,一个触碰(touch)事件周期便开始了。每次一个手指触碰到屏幕,一个新的touchstart事件开始了。当手指离开屏幕的时候,一个touchend事件开始。当手指接触到屏幕后,如果在屏幕上移动手指,一个touchmove事件触发了。如果过多的手指同时接触屏幕或触碰被其他事件中断,如消息推送,那么touchcancel事件触发了。《iOS human interface guidelines》定义了8种手势,翻译不好,直接把原文搬过来:

Gesture             |    Action

Tap                   |    To press or select a contro or item(analogous to single mouse click)

Drag                 |     To scroll or pan(that is, move side to side). OR To drag a element.

Flick                  |    To scroll or pan quickly.

Swipe                |    With one finger, to reveal the Delete button in a table-view row or to reveal Notification Center(from the top edge of the screen).

                        |     With four fingers, to switch between apps on iPad.

Double Tap        |     To zoom in and center a block of content or an image.

                        |     To zoom out(if already zoomed in).

Pinch                 |     Pinch open to zoom in.

                        |     Pinch close to zoom out.

Touch and hold  |     In editable or selectable text, to display a magnified view for cursor positioning.

Shake               |     To initiate an undo or redo action.

      Xcode提供了iOS Simulator,位于/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/ 这个simulator可以模拟iPhone/iPad的运行环境。通过将自己的app放到/Users/Library/Application Support/iPhone Simulator/5.1/Applications 文件夹下可以实现该app在模拟器上的运行。

更多关于touch和gesture的解释参见

http://www.sitepen.com/blog/2011/12/07/touching-and-gesturing-on-iphone-android-and-more/

http://www.w3.org/TR/touch-events/