close keyboard when Done is pressed (#20341)

* close keyboard when Done is pressed
This commit is contained in:
minggo 2019-11-18 10:15:20 +08:00 committed by halx99
parent 238cd782e3
commit 1934eb5ac9
1 changed files with 6 additions and 0 deletions

View File

@ -389,6 +389,12 @@
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if ( self.keyboardReturnType == cocos2d::ui::EditBox::KeyboardReturnType::DONE &&
[text isEqualToString: @"\n"] )
{
[self closeKeyboard];
}
int maxLength = getEditBoxImplIOS()->getMaxLength();
if (maxLength < 0)
{