How do I show suggestions in real time (for example, existing entries with the same start characters) when the user enters a text field in Cocoa Touch?
I am wondering if there is an existing class or library code in Cocoa Touch that shows the user a list of suggestions in real time as they enter text input, with suggestions based on the similarity between what they already have entered and previous entries.
For example, watch Safari on the iPod Touch show suggestions in real time when you start typing a URL based on previously visited sites.
If there is a standard way to do this, I'd love to know! If not, suggestions for a sane way to implement this is to subclass UITextField and from there? - we will be glad.
0
Uberc
source
to share
2 answers
I would suggest looking at the delegate method:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
You will need to collapse your own auto-complete, similar to what Apple uses for its suggestive auto-complete functionality.
+1
source to share