File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -360,7 +360,10 @@ - (CGRect) convertRectFromViewToSurface:(CGRect)rect
360360// Pass the touches to the superview
361361#pragma mark CCEAGLView - Touch Delegate
362362- (void )touchesBegan : (NSSet *)touches withEvent : (UIEvent *)event
363- {
363+ {
364+ if (self.isKeyboardShown )
365+ [self closeKeyboardOpenedByEditBox ];
366+
364367 UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0 };
365368 float xs[IOS_MAX_TOUCHES_COUNT] = {0 .0f };
366369 float ys[IOS_MAX_TOUCHES_COUNT] = {0 .0f };
@@ -671,4 +674,23 @@ - (void)onUIKeyboardNotification:(NSNotification *)notif
671674 }
672675}
673676
677+ // Close the keyboard opened by EditBox
678+ -(void ) closeKeyboardOpenedByEditBox
679+ {
680+ NSArray *subviews = self.subviews ;
681+
682+ for (UIView* view in subviews)
683+ {
684+ if ([view isKindOfClass: NSClassFromString (@" UITextView" )] ||
685+ [view isKindOfClass: NSClassFromString (@" UITextField" )])
686+ {
687+ if ([view isFirstResponder ])
688+ {
689+ [view resignFirstResponder ];
690+ return ;
691+ }
692+ }
693+ }
694+ }
695+
674696@end
You can’t perform that action at this time.
0 commit comments