* [ios] try to fix remove gesture crash

Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/8fff8cd8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/8fff8cd8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/8fff8cd8

Branch: refs/heads/master
Commit: 8fff8cd813ee3bf269c4bc527261399d1536d8b4
Parents: 0e9760a
Author: acton393 <zhangxing610...@gmail.com>
Authored: Mon Sep 25 14:46:40 2017 +0800
Committer: acton393 <zhangxing610...@gmail.com>
Committed: Mon Sep 25 14:46:40 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Model/WXComponent.m | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8fff8cd8/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m 
b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
index 2bad1c2..9a2966a 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
@@ -38,6 +38,7 @@
 #import "WXComponent+PseudoClassManagement.h"
 #import "WXComponent+BoxShadow.h"
 #import "WXTracingManager.h"
+#import "WXComponent+Events.h"
 
 #pragma clang diagnostic ignored "-Wincomplete-implementation"
 #pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
@@ -190,7 +191,25 @@
 {
     free_css_node(_cssNode);
 
-    [self _removeAllEvents];
+//    [self _removeAllEvents];
+    // remove all gesture and all
+    if (_tapGesture) {
+        [_tapGesture removeTarget:nil action:NULL];
+    }
+    if ([_swipeGestures count]) {
+        for (UISwipeGestureRecognizer *swipeGestures in _swipeGestures) {
+            [swipeGestures removeTarget:nil action:NULL];
+        }
+    }
+    
+    if (_longPressGesture) {
+        [_longPressGesture removeTarget:nil action:NULL];
+    }
+    
+    if (_panGesture) {
+        [_panGesture removeTarget:nil action:NULL];
+    }
+    
     if (_positionType == WXPositionTypeFixed) {
         [self.weexInstance.componentManager removeFixedComponent:self];
     }

Reply via email to