I'm doing some custom auto-complete stuff on my own with insertText:
, but if there's an autocorrect suggestion visible the view gets into a weird state.
If I use [textView unmarkText]
, it dismisses the autocorrect popup thingy -- but it accepts the autocorrection (which is bad). Is there some way to programmatically reject the autocorrect suggestion?
My current "solution" works, but it's gross and hacky and I have no reason to assume it will continue to work in the future. Is there a better way to do this?
- (void)dismissAutocorrectSuggestionForTextView:(UITextView *)textView {
NSRange range = textView.selectedRange;
textView.text = textView.text;
textView.selectedRange = range;
}