iPhone:以编程方式查找相册中的视频和图像数量?

iPhone:以编程方式查找相册中的视频和图像数量?

问题描述:

我在iOS 4.3 SDK上开发app。我想知道,如何找到相机照片库相册中有多少图像和视频。是否有可能以编程方式找到一种方法来了解相册中的视频和图像数量?

I am developing app on iOS 4.3 SDK. I would like to know, how to find how many images and videos are there in Camera photo library album. Is it possible to programmatically find a way to know the count of videos and images there in photo album?

请提供建议。

谢谢!

使用ALAssetsLibrary

use ALAssetsLibrary

http://developer.apple.com/library /ios/#documentation/AssetsLibrary/Reference/ALAssetsLibrary_Class/Reference/Reference.html

如何使用它的一个很好的例子可以在链接$ b找到$ b http://iphonetuts.com/tag/alassetslibrary-tutorial/

A good example how to use it can be find at link http://iphonetuts.com/tag/alassetslibrary-tutorial/

27    [library enumerateGroupsWithTypes:ALAssetsGroupAlbum
28                     usingBlock:assetGroupEnumerator
29                   failureBlock: ^(NSError *error) {
30                       NSLog(@"Failure");
31                   }];

将ALAssetsGroupAlbum替换为ALAssetsGroupSavedPhotos

replace "ALAssetsGroupAlbum" with "ALAssetsGroupSavedPhotos"