UIReferenceLibraryViewController的使用(调用系统词典)
2015-02-20 21:29
561 查看
在程序中使用苹果的词典来查询词汇,即一些软件的“词典"功能
UIReferenceLibraryViewController和MFMessageComposeViewController很相似,提供了最小化配置的系统层viewController,可以直接被present显示。
可用需要查找term来进行初始化:
UIReferenceLibraryViewController *referenceLibraryViewController =
[[UIReferenceLibraryViewController alloc] initWithTerm:@"apple"];
[viewController presentViewController:referenceLibraryViewController animated:YES completion:nil];
这种行为和用户点击UITextView中高亮词汇弹出的"定义"的UIMenuItem的效果差不多。
UIReferenceLibraryViewController也提供了一个类方法dictionaryHasDefinitionForTerm:,开发者可以在dictionary view controller出现之前调用这个方法,就可以在不必需的时候不显示那个viewController了。
[UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:@"apple"];
在这两种情况下,UIReferenceLibraryViewController会以非常好的形式去格式化搜索结果,所以并不需要开发者手动去掉空格或者调整大小写来优化搜索。
UIReferenceLibraryViewController和MFMessageComposeViewController很相似,提供了最小化配置的系统层viewController,可以直接被present显示。
可用需要查找term来进行初始化:
UIReferenceLibraryViewController *referenceLibraryViewController =
[[UIReferenceLibraryViewController alloc] initWithTerm:@"apple"];
[viewController presentViewController:referenceLibraryViewController animated:YES completion:nil];
这种行为和用户点击UITextView中高亮词汇弹出的"定义"的UIMenuItem的效果差不多。
UIReferenceLibraryViewController也提供了一个类方法dictionaryHasDefinitionForTerm:,开发者可以在dictionary view controller出现之前调用这个方法,就可以在不必需的时候不显示那个viewController了。
[UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:@"apple"];
在这两种情况下,UIReferenceLibraryViewController会以非常好的形式去格式化搜索结果,所以并不需要开发者手动去掉空格或者调整大小写来优化搜索。
相关文章推荐
- iOS开发 UIReferenceLibraryViewController(词典)的使用
- UIReferenceLibraryViewController iOS自带的词典controller
- ios字典功能UIReferenceLibraryViewController
- UIReferenceLibraryViewController:App中字典词义查询的实现
- iOS开发UI基础—32直接使用UITableView Controller
- IOS UISplitViewController之 解决 密码框添加之后 调用子视图的转向方法之时 对象为空
- iOS9 系统分享调用(UIActivityViewController)
- UI: 使用 UIActivityViewController 显示分享选项
- ios-使用iPad专用API(UISplitViewController)控制器
- 下载文件 ,调用系统的方法(UIDocumentInteractionController) 查看
- iOS系统UIPickerView的简单使用和方法属性介绍
- ios-day10-01(模仿点菜系统。UIPickerView的使用、如何产生随机数等)
- iOS开发 点菜系统 使用UIPickerView
- iOS9 系统分享调用之UIActivityViewController
- iOS之UI--使用SWRevealViewController实现侧边菜单功能详解实例
- iOS UISplitViewController 使用教学
- UI: 用 UISplitViewController 显示 Master-Detail 视图 ;使用 UIPageViewController 启用分页;使用 UIPopoverController 显示弹出画面(弹出框)
- 使用dismissModalViewControllerAnimated 不调用dealloc 内存不释放解决方法
- UI -- UIImageViewController的使用