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 @@ -235,7 +235,10 @@ - (CGRect) convertRectFromViewToSurface:(CGRect)rect
235235// Pass the touches to the superview
236236#pragma mark CCEAGLView - Touch Delegate
237237- (void )touchesBegan : (NSSet *)touches withEvent : (UIEvent *)event
238- {
238+ {
239+ if (self.isKeyboardShown )
240+ [self closeKeyboardOpenedByEditBox ];
241+
239242 UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0 };
240243 float xs[IOS_MAX_TOUCHES_COUNT] = {0 .0f };
241244 float ys[IOS_MAX_TOUCHES_COUNT] = {0 .0f };
@@ -546,4 +549,23 @@ - (void)onUIKeyboardNotification:(NSNotification *)notif
546549 }
547550}
548551
552+ // Close the keyboard opened by EditBox
553+ -(void ) closeKeyboardOpenedByEditBox
554+ {
555+ NSArray *subviews = self.subviews ;
556+
557+ for (UIView* view in subviews)
558+ {
559+ if ([view isKindOfClass: NSClassFromString (@" UITextView" )] ||
560+ [view isKindOfClass: NSClassFromString (@" UITextField" )])
561+ {
562+ if ([view isFirstResponder ])
563+ {
564+ [view resignFirstResponder ];
565+ return ;
566+ }
567+ }
568+ }
569+ }
570+
549571@end
You can’t perform that action at this time.
0 commit comments