YYGestureRecognizer
1.结构
image继承UIGestureRecognizer 增加四个属性,startPoint ,lastPoint currentPoint,还有一个block
typedef NS_ENUM(NSUInteger, YYGestureRecognizerState) {
YYGestureRecognizerStateBegan, ///< gesture start
YYGestureRecognizerStateMoved, ///< gesture moved
YYGestureRecognizerStateEnded, ///< gesture end
YYGestureRecognizerStateCancelled, ///< gesture cancel
};
枚举了yygestureRecognizerstate 四种状态
2、初始化
沿用父类的初始化方法。
3、public 方法
只有一个方法
- (void)cancel;
4、override方法
这个类主要是是override 方法多一共四个
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event ;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event ;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event ;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event ;
- (void)reset;
源码实现起来简单。这里不做介绍
网友评论