Created
October 8, 2012 07:11
-
-
Save nacho4d/3851151 to your computer and use it in GitHub Desktop.
Dismiss the UIAutocorrectionInlinePrompt manually - Private API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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