2017-08-17 4 views

答えて

0

スウィフト3

if UIReferenceLibraryViewController.dictionaryHasDefinition(forTerm: "word") { 
      let libraryVC = UIReferenceLibraryViewController(term: "word") 
      self.present(libraryVC, animated: true, completion: nil) 
     } 

コード自体が、それははい、あなたが試してみることも説明

0

を必要としない、かなり明確です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) 
} 
関連する問題