Skip to content

Instantly share code, notes, and snippets.

@nacho4d
Created October 8, 2012 07:11
Show Gist options
  • Save nacho4d/3851151 to your computer and use it in GitHub Desktop.
Save nacho4d/3851151 to your computer and use it in GitHub Desktop.
Dismiss the UIAutocorrectionInlinePrompt manually - Private API
// Find and dismiss the UIAutocorrectionInlinePrompt view
// target is an instance of UITextView
NSArray *textviewSubviews = [target subviews];
NSInteger correctionViewIndex = [textviewSubviews indexOfObjectPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) {
if ([[[obj class] description] isEqualToString:@"UIAutocorrectInlinePrompt"]) {
*stop = YES;
return YES;
} else {
return NO;
}
}];
if (correctionViewIndex != NSNotFound) {
UIView *correctionView = [textviewSubviews objectAtIndex:correctionViewIndex];
if ([correctionView respondsToSelector:@selector(dismiss)]) {
[correctionView performSelector:@selector(dismiss)];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment