I'm a new to develope App with Swift.
I want to ask you guys how to implement something like favorite heart button that is same thing in the photo app.
(When you click the heart button, that photo goes into the 'Favorites' album.)
I've been looking for it thousands time on internet.
I couldn't find out.
Please help me and thanks in advanced.
答案 0 :(得分:3)
从PHAssetChangeRequest
PHAsset
开始,假设您有favorite
,您可以通过发出更改请求并修改其PHPhotoLibrary.sharedPhotoLibrary().performChanges({
let request = PHAssetChangeRequest(forAsset: asset)
request.favorite = true
}, completionHandler: { success, error in
//finished
})
属性来将其标记为收藏。例如:
std::shared_ptr