选择图像的 UIImagePicker 幻灯片

编程入门 行业动态 更新时间:2024-10-26 23:41:56
本文介绍了选择图像的 UIImagePicker 幻灯片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

就像照片应用程序显示的那样,所有相册 > 特定相册中的所有照片 > 单张照片视图,

Like the Photos App shows, all albums > all photos in a particular album > single photo view,

即使我需要类似的视图.我已经使用了 UIImagePickerController 并且很容易进入第二步.但是,每当我选择图像时,我都无法显示幻灯片类型的视图,因为 UIImagePicker 没有给我.

even I need a similar kind of a view. I have used UIImagePickerController and easily go to the second step. However, whenever I select an image, I can not show a slide show kind of a view, as UIImagePicker does not give me that.

我制作了另一个视图控制器,只是为了以分页形式显示这些图像.

I made another view controller , just to display these images in a pagenation form.

But, from the delegate method, didFinishPickingMediaWithInfo, when an image is selected, I get only that image using:

But, from the delegate method, didFinishPickingMediaWithInfo, when an image is selected, I get only that image using:

[info objectForKey:UIImagePickerControllerOriginalImage];

我如何知道此图像旁边和此图像之前的图像,以便我可以创建幻灯片?

How do I know the images next to this image, and before this image, so that I can create a slide show?

推荐答案

查看 ALAssetsLibrary.要获取照片库中的图像或视频列表,您可以使用 ALAssetsLibrary 对象的 enumerateGroupsUsingTypes:usingBlock:failureBlock: 方法.例如,您可以调用此方法,然后在它异步返回图像和视频时,您将为幻灯片视图构建图像数组.

Check out the documentation for ALAssetsLibrary. To obtain a list of images or videos in the Photo library you would use the enumerateGroupsUsingTypes:usingBlock:failureBlock: method of an ALAssetsLibrary object. For instance, you could call this method, then as it asynchronously returns images and video you would build your array of images for the slideshow view.

另请查看此 SO 主题.答案显示了如何从 UIImagePickerController 获取 ALAsset 对象,它可以让您找到图像的 URL 和其他相关信息.

Also check out this SO thread. The answer shows how to get an ALAsset object from the UIImagePickerController, which lets you find the URL of the image and other info about it.

这篇关于选择图像的 UIImagePicker 幻灯片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-29 03:52:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1184014.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:幻灯片   图像   UIImagePicker

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!