Skip to content

Instantly share code, notes, and snippets.

@codeswimmer
Last active December 10, 2015 12:58
Show Gist options
  • Select an option

  • Save codeswimmer/4437547 to your computer and use it in GitHub Desktop.

Select an option

Save codeswimmer/4437547 to your computer and use it in GitHub Desktop.
iOS: How To Find A Word Definition In iOS Dictionary
/* iOS 5 has a new framework to look for a word definition and present the definition.
*
* UIReferenceLibraryViewController is a subclas of UIViewController, so you can push
* or present it as modal view controller to see the definition.
*/
NSString *term = @"Reference";
if ([UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:term]) {
NSLog(@"Term: %@, has definition", term);
UIReferenceLibraryViewController *refVC =
[[UIReferenceLibraryViewController alloc] initWithTerm:term];
[self presentModalViewController:refVC animated:YES];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment