在iOS 5中查看字典/定义单词的控制器

adi*_*dit 3 iphone objective-c ipad ios ios5

几周前我看到iOS 5中有一个字典的视图控制器,我们可以传递一个字,它将提供它的定义.我似乎无法再在apple doc中找到文档,有谁知道这个名字是什么?

Sem*_*ium 9

您正在尝试使用UIReferenceLibraryViewController提供的Dictionary服务

// Create the view controller
UIReferenceLibraryViewController *reference = 
  [[[UIReferenceLibraryViewController alloc] initWithTerm:@"Word"] autorelease];

[self presentModalViewController:reference animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

  • +1.在创建和显示`UIReferenceLibraryViewController`的实例之前,使用`+ dictionaryHasDefinitionForTerm:`来确定字典是否有该术语的定义也是一个好主意. (3认同)