I want to know the current input character the user just inputted.Comparing the old and the new input string seems to work, but it must be the last thing I’d like to try.Any suggestion? I guess there are some methods in iOS SDK that can do this in a better way.
I want to know the current input character the user just inputted.Comparing the old
Share
from the UITextFieldDelegate should help you.
It is not only called for replacing text, also whenever the user presses a key on keyboard.
(length of range will be 0 then and the location will be the current insertation position).
See the documentation for more information:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextFieldDelegate_Protocol/UITextFieldDelegate/UITextFieldDelegate.html#//apple_ref/doc/uid/TP40006991-CH3-SW9