forked from shaojiankui/JKCategories
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UIView+GestureCallback.h
96 lines (72 loc) · 5.76 KB
/
UIView+GestureCallback.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//
// UIView+GestureCallback.h
//
// Created by Onur Ersel on 01/07/15.
// Copyright (c) 2015 Onur Ersel. All rights reserved.
//
//https://github.com/onurersel/UIView-GestureCallback
#import <UIKit/UIKit.h>
@interface GestureCallbackValues : NSObject
@property (nonatomic, copy) void (^tapCallback)(UITapGestureRecognizer* recognizer, NSString* gestureId);
@property (nonatomic, copy) void (^pinchCallback)(UIPinchGestureRecognizer* recognizer, NSString* gestureId);
@property (nonatomic, copy) void (^panCallback)(UIPanGestureRecognizer* recognizer, NSString* gestureId);
@property (nonatomic, copy) void (^swipeCallback)(UISwipeGestureRecognizer* recognizer, NSString* gestureId);
@property (nonatomic, copy) void (^rotationCallback)(UIRotationGestureRecognizer* recognizer, NSString* gestureId);
@property (nonatomic, copy) void (^longPressCallback)(UILongPressGestureRecognizer* recognizer, NSString* gestureId);
@property (nonatomic, retain) UIGestureRecognizer *gesture;
@property (nonatomic, retain) NSString *gestureId;
@end
@interface UIView (GestureCallback)
@property (nonatomic) NSMutableDictionary *gestures;
@property (nonatomic) NSMutableDictionary *gestureKeysHash;
// tap
-(NSString*)addTapGestureRecognizer:(void(^)(UITapGestureRecognizer* recognizer, NSString* gestureId))tapCallback;
-(NSString*)addTapGestureRecognizer:(void(^)(UITapGestureRecognizer* recognizer, NSString* gestureId))tapCallback numberOfTapsRequired:(NSUInteger)numberOfTapsRequired numberOfTouchesRequired:(NSUInteger)numberOfTouchesRequired;
-(void)addTapGestureRecognizer:(void(^)(UITapGestureRecognizer* recognizer, NSString* gestureId))tapCallback tapGestureId:(NSString*)tapGestureId;
-(void)addTapGestureRecognizer:(void(^)(UITapGestureRecognizer* recognizer, NSString* gestureId))tapCallback tapGestureId:(NSString*)tapGestureId numberOfTapsRequired:(NSUInteger)numberOfTapsRequired numberOfTouchesRequired:(NSUInteger)numberOfTouchesRequired;
-(void)removeTapGesture:(NSString*)tapGestureId;
-(void)removeAllTapGestures;
-(void)tapHandler:(UITapGestureRecognizer*)recognizer;
// pinch
-(NSString*)addPinchGestureRecognizer:(void(^)(UIPinchGestureRecognizer* recognizer, NSString* gestureId))pinchCallback;
-(void)addPinchGestureRecognizer:(void(^)(UIPinchGestureRecognizer* recognizer, NSString* gestureId))pinchCallback pinchGestureId:(NSString*)pinchGestureId;
-(void)removePinchGesture:(NSString*)pinchGestureId;
-(void)removeAllPinchGestures;
-(void)pinchHandler:(UIPinchGestureRecognizer*)recognizer;
// pan
-(NSString*)addPanGestureRecognizer:(void(^)(UIPanGestureRecognizer* recognizer, NSString* gestureId))panCallback;
-(NSString*)addPanGestureRecognizer:(void(^)(UIPanGestureRecognizer* recognizer, NSString* gestureId))panCallback minimumNumberOfTouches:(NSUInteger)minimumNumberOfTouches maximumNumberOfTouches:(NSUInteger)maximumNumberOfTouches;
-(void)addPanGestureRecognizer:(void(^)(UIPanGestureRecognizer* recognizer, NSString* gestureId))panCallback panGestureId:(NSString*)panGestureId minimumNumberOfTouches:(NSUInteger)minimumNumberOfTouches maximumNumberOfTouches:(NSUInteger)maximumNumberOfTouches;
-(void)removePanGesture:(NSString*)panGestureId;
-(void)removeAllPanGestures;
-(void)panHandler:(UIPanGestureRecognizer*)recognizer;
//swipe
-(NSString*)addSwipeGestureRecognizer:(void(^)(UISwipeGestureRecognizer* recognizer, NSString* gestureId))swipeCallback direction:(UISwipeGestureRecognizerDirection)direction;
-(NSString*)addSwipeGestureRecognizer:(void(^)(UISwipeGestureRecognizer* recognizer, NSString* gestureId))swipeCallback direction:(UISwipeGestureRecognizerDirection)direction numberOfTouchesRequired:(NSUInteger)numberOfTouchesRequired;
-(void)addSwipeGestureRecognizer:(void(^)(UISwipeGestureRecognizer* recognizer, NSString* gestureId))swipeCallback swipeGestureId:(NSString*)swipeGestureId direction:(UISwipeGestureRecognizerDirection)direction numberOfTouchesRequired:(NSUInteger)numberOfTouchesRequired;
-(void)removeSwipeGesture:(NSString*)swipeGestureId;
-(void)removeAllSwipeGestures;
-(void)swipeHandler:(UISwipeGestureRecognizer*)recognizer;
//rotation
-(NSString*)addRotationGestureRecognizer:(void(^)(UIRotationGestureRecognizer* recognizer, NSString* gestureId))rotationCallback;
-(void)addRotationGestureRecognizer:(void(^)(UIRotationGestureRecognizer* recognizer, NSString* gestureId))rotationCallback rotationGestureId:(NSString*)rotationGestureId;
-(void)removeRotationGesture:(NSString*)rotationGestureId;
-(void)removeAllRotationGestures;
-(void)rotationHandler:(UIRotationGestureRecognizer*)recognizer;
//long press
-(NSString*)addLongPressGestureRecognizer:(void(^)(UILongPressGestureRecognizer* recognizer, NSString* gestureId))longPressCallback;
-(NSString*)addLongPressGestureRecognizer:(void(^)(UILongPressGestureRecognizer* recognizer, NSString* gestureId))longPressCallback
numberOfTapsRequired:(NSUInteger)numberOfTapsRequired
numberOfTouchesRequired:(NSUInteger)numberOfTouchesRequired
minimumPressDuration:(CFTimeInterval)minimumPressDuration
allowableMovement:(CGFloat)allowableMovement;
-(void)addLongPressGestureRecognizer:(void(^)(UILongPressGestureRecognizer* recognizer, NSString* gestureId))longPressCallback
longPressGestureId:(NSString*)longPressGestureId
numberOfTapsRequired:(NSUInteger)numberOfTapsRequired
numberOfTouchesRequired:(NSUInteger)numberOfTouchesRequired
minimumPressDuration:(CFTimeInterval)minimumPressDuration
allowableMovement:(CGFloat)allowableMovement;
-(void)removeLongPressGesture:(NSString*)longPressGestureId;
-(void)removeAllLongPressGestures;
-(void)longPressHandler:(UILongPressGestureRecognizer*)recognizer;
@end