问题
I have a UITextField. While user is typing, I am using
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
to validate the string. And if the string is valid I want to enable the return key; if it is not valid I want to disable the return key. Is there a way to do this?
For example the return key would be disabled while the user types the characters in avai
. Then the return would become enabled after the user finishes typing avail
. Then the return would be disabled again as user types availabl
; then become enabled again as user types available
.
来源:https://stackoverflow.com/questions/25728778/enable-and-disable-keyboard-return-key-on-demand-in-ios