在照片应用程序中创建、删除图片以及将图片添加到相册?

发布于 2024-12-13 04:52:58 字数 117 浏览 0 评论 0原文

还没有看到任何东西,但我看到你可以在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乱了心跳 2024-12-20 04:52:58

从 iOS5 开始,您可以通过编程方式将相册添加到照片中。请参阅 ALAssetsLibrary 类参考

您可以通过以下方式添加相册(即 ALAssetsGroup):

addAssetsGroupAlbumWithName:resultBlock:failureBlock:

每个 ALAssetsGroup 都有一个与其关联的 URL。您需要保存它:

valueForProperty:ALAssetsGroupPropertyURL

然后您可以使用该 URL 获取 ALAssetsGroup 对象:

groupForURL:resultBlock:failureBlock:

获得 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:

addAssetsGroupAlbumWithName:resultBlock:failureBlock:

Every ALAssetsGroup has a URL associated with it. You'll want to save it:

valueForProperty:ALAssetsGroupPropertyURL

You can then use that URL to get an ALAssetsGroup object:

groupForURL:resultBlock:failureBlock:

Once you have your ALAssetsGroup you can use addAsset: 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.

有木有妳兜一样 2024-12-20 04:52:58

请参阅 UIImage 类参考:

http:// developer.apple.com/library/ios/#documentation/uikit/reference/UIImage_Class/Reference/Reference.html

void UIImageWriteToSavedPhotosAlbum (
   UIImage  *image,
   id       completionTarget,
   SEL      completionSelector,
   void     *contextInfo
);

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

void UIImageWriteToSavedPhotosAlbum (
   UIImage  *image,
   id       completionTarget,
   SEL      completionSelector,
   void     *contextInfo
);

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文