ALAssetsLibrary

ALAsset

  An ALAsset object represent a photo or a video managed by the Photo application.

  Assets can have multiple representations, for example a photo which was captured in RAW and JPG. Different representations of the same asset may have different dimensions.

ALAssetsGroup

  An ALAssetsGroup object represents an ordered set of the assets managed by the Photos application. The order of the elements is the same as the user sees in the Photos application. An asset can belong to multiple assets groups.

  Assets groups themselves are synced via iTunes, created to hold the user’s saved photos or created during camera import. You can indirectly modify the Saved Photos group by saving images or videos into it using the ALAssetsLibrary class.

ALAssetsLibrary

  An instance of ALAssetsLibrary provides access to the videos and photos that are under the control of the Photos application.

  The library includes those that are in the Saved Photos album, those coming from iTunes, and those that were directly imported into the device. You use it to retrieve the list of all asset groups and to save images and videos into the Saved Photos album.

  The lifetimes of objects you get back from a library instance are tied to the lifetime of the library instance.(从library中得到的对象的生命周期和library的生命周期绑定)

  Many of the methods declared by ALAssetsLibrary take blocks for failure and success as arguments. These methods are all asynchronous because the user may need to be asked to grant access to the data.

时间: 2024-11-05 14:54:28

ALAssetsLibrary的相关文章

ALAssetsLibrary使用

在iOS中,我们调用摄像头和选择相册中的资源,我们可以使用:UIImagePickerController类来完成. 当然,我们也可以不使用UI的形式来访问iOS设备的相册资源. 那就是使用:ALAssetsLibrary 一.ALAssetsLibrary是什么 可以说,是一个桥梁把.连接了我们应用程序和相册之间的访问. ALAssetsLibrary提供了我们对iOS设备中的相片.视频的访问. ALAssetsLibrary被封装在 框架中.所以,我们在使用时,需要引入该框架. 需添加Ass

ios 相册操作 ALAssetsLibrary

1.ALAssetsLibrary 实例为我们提供了获取相册(照片app)中的图片和视频的功能.在ios8 photos framework代替了ALAssetsLibrary. 在使用ALAssetsLibrary时,我们需要申明它的实例. ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init]; 2. 迭代获取相册ALAssetsGroup: - (void)enumerateGroupsWithTypes:(ALAssetsGro

Swift - 使用ALAssetsLibrary获取相簿里所有图片,视频(附样例)

1,ALAssetsLibrary介绍 (1)通过创建ALAssetsLibrary的实例可以访问系统Photos里的图片与视频.这里图片不仅包括相机拍摄的照片,还包括从iTunes导入的和从其他设备里面导入的图片. (2)从ALAssetsLibrary实例中获取得到的对象的生命周期和ALAssetsLibrary这个实例的生命周期一致. (3)通过enumerateGroupsWithTypes方法可以遍历所有的照片分组,再用分组的enumerateAssetsUsingBlock方法可以遍

解决iOS8下ALAssetsLibrary创建相册的bug

说到ALAssetsLibrary,相信搞iOS开发的大都知道它,在iOS上做过相册相关功能的应该对这个都比较熟悉了,用它来操作访问相册是很方便的.但是,,,,自从iOS8发布后,ALAssetsLibrary在Stack Overflow上被各种讨论了.因为在iOS8上用这个库创建相册会有个bug:创建相册,手动删除它,再用这个库去创建刚被删除的相册,这个时候方法回调是不会跑fail模块的,它走的是正常流程,但是带回来的group却是nil. - (void)addAssetsGroupAlb

ios ALAssetsLibrary简单的使用

关于ALAssetsLibrary的简单使用有两个方面: 第一:存储图片/视频方法如下: // With a UIImage, the API user can use -[UIImage CGImage] to get a CGImageRef, and cast -[UIImage imageOrientation] to ALAssetOrientation.- (void)writeImageToSavedPhotosAlbum:(CGImageRef)imageRef orientat

iOS 使用ALAssetsLibrary保存图片到本地

第一步:添加 AssetsLibrary.framework 框架 第二步:需要使用的类里面导入头文件 #import <AssetsLibrary/AssetsLibrary.h> 第三步:保存网络图片到本地 - (void)viewDidLoad {     [super viewDidLoad];     UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@

ALAssetsLibrary学习总结

添加AssetsLibrary.framework 然后引入 #import <AssetsLibrary/ALAssetsLibrary.h> 一个获取所有图片的类 #import <UIKit/UIKit.h> #include<AssetsLibrary/AssetsLibrary.h> @interface ViewController : UIViewController{ ALAssetsLibrary *library; NSArray *imageArr

AVFoundation实现相机和使用ALAssetsLibrary

// //  ViewController.m //  AVFoundtion // //  Created by King on 16/8/26. //  Copyright © 2016年 King. All rights reserved. // #import "ViewController.h" #import <AVFoundation/AVFoundation.h> #import <AssetsLibrary/AssetsLibrary.h> t

用ALAssetsLibrary将过滤后图片写入照片库

转载自:http://blog.sina.com.cn/s/blog_61235faa0100z3dp.html CIImage *saveToSave = [filter outputImage]; CGImageRef cgImg = [context createCGImage:saveToSave fromRect:[saveToSave extent]]; ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init]; [libra