1

查看ALAssetsLibrary API,我看到了一些创建新资产的方法: writeImageDataToSavedPhotosAlbum:metadata:completionBlock: writeImageToSavedPhotosAlbum:metadata:completionBlock: writeImageToSavedPhotosAlbum:orientation:completionBlock: writeVideoAtPathToSavedPhotosAlbum:completionBlock:

这些似乎表明您应该只创建新资产。不过我的问题是:有没有办法对资产进行破坏性编辑?还是您总是为编辑创建新图像?我希望是后者,因为我希望每个资产都被视为唯一的、仅创建一次的资产。

4

2 回答 2

2

I have found no possible way to remove or alter assets in the library. Its kind of a pain when I create items in the assets library and I cannot remove them. But that appears to be apples wishes. Most likely because they do not want an app to be able to delete images and videos from the users library. Only by going to the camera app or another "Apple" app will the asset be able to be removed.

I kind of wish they would let you popup a delete confirmation window for an asset to let the user decide on a (apple created) confirmation page.

于 2012-08-22T17:58:38.307 回答
1

我还没有尝试过,但从 iOS 5 开始,如果图像被标记为可编辑(仅当图像最初是由您的应用程序创建的),似乎可以使用setImageDataon 方法编辑图像:ALAsset

http://developer.apple.com/library/ios/#documentation/AssetsLibrary/Reference/ALAsset_Class/Reference/Reference.html#//apple_ref/occ/instm/ALAsset/setImageData:metadata:completionBlock

不过,似乎无法删除图像。

于 2013-07-29T04:19:13.277 回答