About implementing photo favorites heart button in Swift

时间:2015-07-29 00:02:20

标签: xcode swift

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.

1 个答案:

答案 0 :(得分:3)

PHAssetChangeRequest PHAsset开始,假设您有favorite,您可以通过发出更改请求并修改其PHPhotoLibrary.sharedPhotoLibrary().performChanges({ let request = PHAssetChangeRequest(forAsset: asset) request.favorite = true }, completionHandler: { success, error in //finished }) 属性来将其标记为收藏。例如:

std::shared_ptr