选择图像的 UIImagePicker 幻灯片 [英] UIImagePicker slideshow of images on selection

查看:27
本文介绍了选择图像的 UIImagePicker 幻灯片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆