手势识别(一)手势识别器

iOS手势识别相关编程技术使手势识别器”,他的介绍如下


Gesture recognizers convert low-level event handling code into higher-level actions. They are objects that you attach to a view, which allows the view to respond to actions the way a control does. Gesture recognizers interpret touches to determine whether they correspond to a specific gesture, such as a swipe, pinch, or rotation. If they recognize their assigned gesture, they send an action message to a target object. The target object is typically the view’s view controller, which responds to the gesture as shown in Figure 1-1. This design pattern is both powerful and simple; you can dynamically determine what actions a view responds to, and you can add gesture recognizers to a view without having to subclass the view.

手势识别器把低层次的事件处理代码转换为高层次的操作。 它们是你连接到视图的各种对象,它们允许视图像控件一样响应各种操作。手势识别器翻译(interpret)各种触摸来决定它们是否响应一个特定的手势,比如一个点击(swipe), 捏合(pinch),或旋转。 如果它们识别到它们指定的手势,就给目标对象发送一个操作信息。 目标对象通常是视图的视图控制器,它响应如图1-1中所示的手势。该设计模式既有力又简单;你可以动态地决定视图响应什么操作,你也可以给视图添加各种手势识别而不必要子类化该视图。

Figure 1-1  A gesture recognizer attached to a view

图1-1 一个连接到视图的手势识别




你可能感兴趣的:(ios控件)