From 957dc2929c7ef5c589752d011e8d0bb9aef17d3d Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 7 Nov 2019 09:40:22 +0800 Subject: [PATCH 1/2] fix infinite loop --- cocos/platform/ios/CCEAGLView-ios.h | 2 +- cocos/platform/ios/CCEAGLView-ios.mm | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/cocos/platform/ios/CCEAGLView-ios.h b/cocos/platform/ios/CCEAGLView-ios.h index e9bc020e7084..65c7a6b80357 100644 --- a/cocos/platform/ios/CCEAGLView-ios.h +++ b/cocos/platform/ios/CCEAGLView-ios.h @@ -116,6 +116,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. @property(nonatomic,readonly) EAGLContext *context; @property(nonatomic,readwrite) BOOL multiSampling; +@property(nonatomic, readonly) BOOL isKeyboardShown; /** CCEAGLView uses double-buffer. This method swaps the buffers */ @@ -132,5 +133,4 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. -(void) showKeyboard; -(void) hideKeyboard; --(BOOL) isKeyboardShown; @end diff --git a/cocos/platform/ios/CCEAGLView-ios.mm b/cocos/platform/ios/CCEAGLView-ios.mm index 092a45cb7043..7fb69e65fd6a 100644 --- a/cocos/platform/ios/CCEAGLView-ios.mm +++ b/cocos/platform/ios/CCEAGLView-ios.mm @@ -78,7 +78,7 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE @interface CCEAGLView () @property (nonatomic) CCInputView* textInputView; -@property(nonatomic) BOOL isKeyboardShown; +@property(nonatomic, readwrite, assign) BOOL isKeyboardShown; @property(nonatomic, copy) NSNotification* keyboardShowNotification; @property(nonatomic, assign) CGRect originalRect; @end @@ -472,11 +472,6 @@ - (void) hideKeyboard [self.textInputView removeFromSuperview]; } --(BOOL) isKeyboardShown -{ - return self.isKeyboardShown; -} - -(void) doAnimationWhenKeyboardMoveWithDuration:(float) duration distance:(float) dis { [UIView beginAnimations:nil context:nullptr]; From ce2142e6ee8a0ebf10e223af49952493e333ae2c Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 7 Nov 2019 10:11:38 +0800 Subject: [PATCH 2/2] fix issue that touch event does not match If click area ouside keyboard, then engine only receive touch begin event witouth touch end or touch cancled event. --- cocos/platform/ios/CCInputView-ios.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cocos/platform/ios/CCInputView-ios.mm b/cocos/platform/ios/CCInputView-ios.mm index d6583f8cfa10..9313f3ee5c16 100644 --- a/cocos/platform/ios/CCInputView-ios.mm +++ b/cocos/platform/ios/CCInputView-ios.mm @@ -38,13 +38,12 @@ - (BOOL) canBecomeFirstResponder { return YES; } -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self resignFirstResponder]; [self removeFromSuperview]; } - #pragma TextInput protocol - (id)inputDelegate {