From 83b9d5c682b21d88133f24da0f94dd56bd79e687 Mon Sep 17 00:00:00 2001
From: 单军华
Date: Thu, 19 Jul 2018 13:38:55 +0800
Subject: [PATCH] change

---
 screendisplay/Pods/YYCategories/YYCategories/UIKit/UIGestureRecognizer+YYAdd.m |   78 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/screendisplay/Pods/YYCategories/YYCategories/UIKit/UIGestureRecognizer+YYAdd.m b/screendisplay/Pods/YYCategories/YYCategories/UIKit/UIGestureRecognizer+YYAdd.m
new file mode 100755
index 0000000..61a25e8
--- /dev/null
+++ b/screendisplay/Pods/YYCategories/YYCategories/UIKit/UIGestureRecognizer+YYAdd.m
@@ -0,0 +1,78 @@
+//
+//  UIGestureRecognizer+YYAdd.m
+//  YYCategories <https://github.com/ibireme/YYCategories>
+//
+//  Created by ibireme on 13/10/13.
+//  Copyright (c) 2015 ibireme.
+//
+//  This source code is licensed under the MIT-style license found in the
+//  LICENSE file in the root directory of this source tree.
+//
+
+#import "UIGestureRecognizer+YYAdd.h"
+#import "YYCategoriesMacro.h"
+#import <objc/runtime.h>
+
+static const int block_key;
+
+@interface _YYUIGestureRecognizerBlockTarget : NSObject
+
+@property (nonatomic, copy) void (^block)(id sender);
+
+- (id)initWithBlock:(void (^)(id sender))block;
+- (void)invoke:(id)sender;
+
+@end
+
+@implementation _YYUIGestureRecognizerBlockTarget
+
+- (id)initWithBlock:(void (^)(id sender))block{
+    self = [super init];
+    if (self) {
+        _block = [block copy];
+    }
+    return self;
+}
+
+- (void)invoke:(id)sender {
+    if (_block) _block(sender);
+}
+
+@end
+
+
+
+
+@implementation UIGestureRecognizer (YYAdd)
+
+- (instancetype)initWithActionBlock:(void (^)(id sender))block {
+    self = [self init];
+    [self addActionBlock:block];
+    return self;
+}
+
+- (void)addActionBlock:(void (^)(id sender))block {
+    _YYUIGestureRecognizerBlockTarget *target = [[_YYUIGestureRecognizerBlockTarget alloc] initWithBlock:block];
+    [self addTarget:target action:@selector(invoke:)];
+    NSMutableArray *targets = [self _yy_allUIGestureRecognizerBlockTargets];
+    [targets addObject:target];
+}
+
+- (void)removeAllActionBlocks{
+    NSMutableArray *targets = [self _yy_allUIGestureRecognizerBlockTargets];
+    [targets enumerateObjectsUsingBlock:^(id target, NSUInteger idx, BOOL *stop) {
+        [self removeTarget:target action:@selector(invoke:)];
+    }];
+    [targets removeAllObjects];
+}
+
+- (NSMutableArray *)_yy_allUIGestureRecognizerBlockTargets {
+    NSMutableArray *targets = objc_getAssociatedObject(self, &block_key);
+    if (!targets) {
+        targets = [NSMutableArray array];
+        objc_setAssociatedObject(self, &block_key, targets, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+    }
+    return targets;
+}
+
+@end

--
Gitblit v1.8.0