Enable and disable on-demand keyboard return key in iOS

I have a UITextField. While the user is typing, I use

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 

to check the string. And if the string is valid, I want to include a return key; if it is invalid, I want to disable the return key. Is there any way to do this?

For example, the return key will be disabled when the user enters characters in avai . Then the refund will be enabled after the user has completed entering the text avail . Then the return will be disabled again, as the user types availabl ; then turns back on when the user enters available .

+3
source share

Source: https://habr.com/ru/post/1242817/


All Articles