Skip to content

Commit 282f3fa

Browse files
authored
fix issues of textfield (#20303)
* fix infinite loop * 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.
1 parent 846e57b commit 282f3fa

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

cocos/platform/ios/CCEAGLView-ios.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
116116
@property(nonatomic,readonly) EAGLContext *context;
117117

118118
@property(nonatomic,readwrite) BOOL multiSampling;
119+
@property(nonatomic, readonly) BOOL isKeyboardShown;
119120

120121

121122
/** CCEAGLView uses double-buffer. This method swaps the buffers */
@@ -132,5 +133,4 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
132133

133134
-(void) showKeyboard;
134135
-(void) hideKeyboard;
135-
-(BOOL) isKeyboardShown;
136136
@end

cocos/platform/ios/CCEAGLView-ios.mm

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
7878

7979
@interface CCEAGLView ()
8080
@property (nonatomic) CCInputView* textInputView;
81-
@property(nonatomic) BOOL isKeyboardShown;
81+
@property(nonatomic, readwrite, assign) BOOL isKeyboardShown;
8282
@property(nonatomic, copy) NSNotification* keyboardShowNotification;
8383
@property(nonatomic, assign) CGRect originalRect;
8484
@end
@@ -472,11 +472,6 @@ - (void) hideKeyboard
472472
[self.textInputView removeFromSuperview];
473473
}
474474

475-
-(BOOL) isKeyboardShown
476-
{
477-
return self.isKeyboardShown;
478-
}
479-
480475
-(void) doAnimationWhenKeyboardMoveWithDuration:(float) duration distance:(float) dis
481476
{
482477
[UIView beginAnimations:nil context:nullptr];

cocos/platform/ios/CCInputView-ios.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,12 @@ - (BOOL) canBecomeFirstResponder {
3838
return YES;
3939
}
4040

41-
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
41+
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
4242
{
4343
[self resignFirstResponder];
4444
[self removeFromSuperview];
4545
}
4646

47-
4847
#pragma TextInput protocol
4948

5049
- (id<UITextInputDelegate>)inputDelegate {

0 commit comments

Comments
 (0)