views:

45

answers:

0

I am trying to control/override the auto-complete feature when a user enters text in my iPhone app.

Specifically I'd like to auto-complete a collection of words I supply. For example let's say a word in my list is Macpapajona. When I type "mac" auto-complete will suggest Macpapajona.

How can I do this?

I understand that I have to use this type of method, but what code would provide the replacement bubble? A custom UIView?

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

   if ([textField.text isEqualToString:@"ma"])
   if (![string isEqualToString:@"c"]) {
     // code to pop up a subview that has the word "Macpapajona" in it.
   }
}