在照片应用程序中创建、删除图片以及将图片添加到相册?
还没有看到任何东西,但我看到你可以在 iOS 5 photos.app 中创建相册,我很好奇是否有办法将它集成到我的应用程序中。
我需要能够创建相册、上传图片并能够删除它。
谢谢, 库尔顿
Haven't seen anything, but I have seen that you can create albums in the iOS 5 photos.app, and I was curious if there is a way to integrate it in my app.
I need to be able to create the album, upload pictures to it, and be able to delete it.
Thanks,
Coulton
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 iOS5 开始,您可以通过编程方式将相册添加到照片中。请参阅 ALAssetsLibrary 类参考。
您可以通过以下方式添加相册(即
ALAssetsGroup
):每个
ALAssetsGroup
都有一个与其关联的 URL。您需要保存它:然后您可以使用该 URL 获取
ALAssetsGroup
对象:获得
ALAssetsGroup
后,您可以使用addAsset:
方法来添加图像或视频。注意:所有这些方法都是异步的并且立即返回。您可以在传递给这些方法的块中完成实际工作。
Since iOS5 you can programmatically add albums to Photos. See the ALAssetsLibrary Class Reference.
You can add an album (which is an
ALAssetsGroup
) with:Every
ALAssetsGroup
has a URL associated with it. You'll want to save it:You can then use that URL to get an
ALAssetsGroup
object:Once you have your
ALAssetsGroup
you can useaddAsset:
method on it to add an image or video.Notice: all these methods are asynchronous and return immediately. You do the actual work in the blocks you pass to these methods.
请参阅 UIImage 类参考:
http:// developer.apple.com/library/ios/#documentation/uikit/reference/UIImage_Class/Reference/Reference.html
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIKitFunctionReference/Reference/reference.html#//apple_ref/c/func/UIImageWriteToSavedPhotosAlbum
添加到本机相册(相机)或保存的相册(无相机)。
See the UIImage class reference:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImage_Class/Reference/Reference.html
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIKitFunctionReference/Reference/reference.html#//apple_ref/c/func/UIImageWriteToSavedPhotosAlbum
Adds to the camera roll album (camera) or saved photos album (no camera).