0
我期待在我的應用程序中訪問iOS字典。有沒有在iOS的構建庫中提供特定單詞的定義。IOS Dictonary獲取特定字的定義
我發現有許多第三方API可以完成這項工作,但他們已經付款。
尋找最佳的解決方案......
我期待在我的應用程序中訪問iOS字典。有沒有在iOS的構建庫中提供特定單詞的定義。IOS Dictonary獲取特定字的定義
我發現有許多第三方API可以完成這項工作,但他們已經付款。
尋找最佳的解決方案......
斯威夫特3
if UIReferenceLibraryViewController.dictionaryHasDefinition(forTerm: "word") {
let libraryVC = UIReferenceLibraryViewController(term: "word")
self.present(libraryVC, animated: true, completion: nil)
}
代碼本身是很清楚的,它不需要解釋
是的,可能是你給嘗試UIReferenceLibraryViewController:
除了定義之外,它還包括檢查給定單詞是否被定義。
的Objective-C:
if ([UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:@"definition"]) {
UIReferenceLibraryViewController* ref =
[[UIReferenceLibraryViewController alloc] initWithTerm:@"definition"];
[currentViewController presentViewController:ref animated:YES completion:nil];
}
斯威夫特:您可以按如下方式使用它
if UIReferenceLibraryViewController.dictionaryHasDefinition(forTerm: "definition") {
let libraryVC = UIReferenceLibraryViewController(term: "definition")
self.present(libraryVC, animated: true, completion: nil)
}