searchAPI(iOS 9新api)
by 伍雪颖
var
searchableItems = [CSSearchableItem]()
let
attributeSet =
CSSearchableItemAttributeSet(itemContentType:
"image"
as
String)
attributeSet.title
=
"wuxueying"
attributeSet.contentDescription
=
"rain"
attributeSet.thumbnailData
=
UIImagePNGRepresentation(UIImage(named:
"avatar")!)
let
item =
CSSearchableItem(uniqueIdentifier:
"1",
domainIdentifier:
"com.xueying.SearchAPIs.people",
attributeSet: attributeSet)
searchableItems.append(item)
CSSearchableIndex.defaultSearchableIndex().indexSearchableItems(searchableItems,
completionHandler:
nil)
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-08-07 17:02:26