2016-04-07 11 views
0

スポットライト検索に表示される画像を切り抜く方法については誰でも知っているので、 'thumbnailData'は円形画像ではありません。正方形の1?スウィフト - スポットライト検索で円形画像を取得する(サムネイル内)

This is taken from RayWenderlich.com

これらのソリューションはいずれも、所望の効果に動作しません:Cut a UIImage into a circle Swift(iOS)

私は正常に画像を切り抜くことができますが、その後スポットライト機能では、トリミングされた/マスクされた境界線の周りに白い背景を置きます。スポットライトの連絡先(kUTTypeContact)で可能ですが、私が見ることのできるコンテンツ(kUTTypeContent)ではありません。ここで

がpeekを取るためにそこに任意のboffinsための私のコードです:

// For storing attributes into Searchable Dictionary 
    internal var attributeSet: CSSearchableItemAttributeSet { 
    let attributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeContent as String) 
    attributeSet.title = "\(firstName) \(surname)" 
    attributeSet.contentDescription = location 
    attributeSet.keywords = ["tennis", "scorelord", firstName, surname, handed, location, "\(itnLevel)"] 
    attributeSet.thumbnailData = UIImageJPEGRepresentation(profileImage, 0.8) 
    attributeSet.thumbnailData?.displayLayer(<#T##layer: CALayer##CALayer#>) 
    return attributeSet 
} 

答えて

1

私も同じ問題に出くわしました。あなたのイメージを想定し

が透明な背景を持って、どのような私のために働いたことは

attributeSet.thumbnailData = UIImagePNGRepresentation(profileImage) 
関連する問題