Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion cocos/platform/ios/CCEAGLView-ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,10 @@ - (CGRect) convertRectFromViewToSurface:(CGRect)rect
// Pass the touches to the superview
#pragma mark CCEAGLView - Touch Delegate
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
{
if (self.isKeyboardShown)
[self closeKeyboardOpenedByEditBox];

UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0};
float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};
float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};
Expand Down Expand Up @@ -671,4 +674,23 @@ - (void)onUIKeyboardNotification:(NSNotification *)notif
}
}

// Close the keyboard opened by EditBox
-(void) closeKeyboardOpenedByEditBox
{
NSArray *subviews = self.subviews;

for(UIView* view in subviews)
{
if([view isKindOfClass:NSClassFromString(@"UITextView")] ||
[view isKindOfClass:NSClassFromString(@"UITextField")])
{
if ([view isFirstResponder])
{
[view resignFirstResponder];
return;
}
}
}
}

@end