Skip to content

Commit cdfc781

Browse files
authored
close keyboard when Done is pressed (#20341)
* close keyboard when Done is pressed
1 parent 1c97e41 commit cdfc781

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,12 @@ - (BOOL)textViewShouldEndEditing:(UITextView *)textView
389389

390390
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
391391
{
392+
if ( self.keyboardReturnType == cocos2d::ui::EditBox::KeyboardReturnType::DONE &&
393+
[text isEqualToString: @"\n"] )
394+
{
395+
[self closeKeyboard];
396+
}
397+
392398
int maxLength = getEditBoxImplIOS()->getMaxLength();
393399
if (maxLength < 0)
394400
{

0 commit comments

Comments
 (0)