UIReferenceLibraryViewController能够实现在自己的应用中使用字典查询词语的含义.
在使用词典之前,需要用dictionaryHasDefinitionForTerm:方法去判断词典中是否有所选词的解释,如果有,则初始化UIReferenceLibraryViewController展示词语的释义.
if ([UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:@"English"]) { UIReferenceLibraryViewController *reference = [[UIReferenceLibraryViewController alloc] initWithTerm:@"English"]; [self presentViewController:reference animated:YES completion:nil]; }
时间: 2024-10-07 14:00:52