Is there a way to override autocomplete such that I can inject my own suggestions from a list? Basically looking for a way to help users quickly fill in a field based on commonly used values.
I've looked into this. While this event gives me a heads up as to the next character getting entered, it still doesn't provide me with a way to pop up or override the autosuggestion feature.
I've looked into this. While this event gives me a heads up as to the next character getting entered, it still doesn't provide me with a way to pop up or override the autosuggestion feature.
They're basically saying to turn off the autocomplete textfield.autocorrectionType = UITextAutocorrectionNone. (I think)
Basically, you're going to create your own autocorrection feature.
Then use that method to check for the word. So in the method you'd be like:
Code:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if ([textField.text isEqualToString:@"fir"])
if (![string isEqualToString:@"e"]) {
// code to pop up a subview that has the word "fire" in it.
}
}
Then you could do many things. When someone hits the enter key, you can check to see if the view is up. If it is, then replace the word in the textField. If someone hits the spacebar (basically, if the replacement string is equal to a space) and the view is up, then replace the word.
I've also thought about using this approach.. I guess my fear is that Apple will reject an application that mimics their autocomplete functionality. In their own words this can be "confusing to the user."
I hate this culture of fear in Apple I totally understand why you feel that way but I'd hope Apple would be more sensible than that.
Anyway, my app Alphonetic has a feature that's totally built about using that method to substitute in new autocompletions. The phrase builder uses that to swap the character 'A' for 'Alpha' and so on. It got approved by Apple so hopefully that's the kind of thing they don't mind.