您的位置:首页 > 运维架构

Gestures and Touches(Chapter 8 of The iPhone™ Developer’s Cookbook)

2010-12-31 13:59 477 查看
  Touches have life cycles. Each touch can pass through any of five phases that represent the progress of the touch within an interface. These phases are as follows:  UITouchPhaseBegan—Starts when users touch the screen.  UITouchPhaseMoved—Means a touch has moved on the screen.  UITouchPhaseStationary—Indicates that a touch remains on the screen surface but that there has not been any movement since the previous event.  UITouchPhaseEnded—Gets triggered when the touch is pulled away from the screen.  UITouchPhaseCancelled—Occurs when the iPhone OS system stops tracking a particular touch.This usually occurs due to a system interruption, such as when the application is no longer active or the view is removed from the window.  Predefined callback methods handle the start, movement, and release of touches from the screen. Corresponding to the phases you’ve already seen, the methods involved are as follows. Notice that UITouchPhaseStationary does not generate a callback.   touchesBegan:withEvent:—Gets called at the starting phase of the event, as the user starts touching the screen.  touchesMoved:withEvent:—Handles the movement of the fingers over time.  touchesEnded:withEvent:—Concludes the touch process, where the finger or fingers are released. It provides an opportune time to clean up any work that was handled during the movement sequence.  touchesCancelled:WithEvent:—Called when Cocoa Touch must respond to a system interruption of the ongoing touch event.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐