本文介绍了ALAssetsLibrary获取相机胶卷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 ALAssetsLibrary枚举所有资产组

以下是代码:

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];

void (^enumerate)(ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop)
{
    if (group == nil)
    {
        // enumerated all albums..
    }

    // I hot to check if group is Camera Roll ?

};

[library enumerateGroupsWithTypes:ALAssetsGroupAll
                       usingBlock:enumerate
                     failureBlock:nil];

如何查看当前枚举的是 CameraRoll

How to check if some current enumerated is CameraRoll?

编辑:正如我测试的那样,它始终是最后一个,使用此枚举。但我不确定这是否是规则,是否有任何我错过的参考?

As i tested it was always the last, using this enumerating. But i am not sure if it is the rule, are there any references that i missed?

推荐答案

从相机胶卷获取照片枚举资产库时使用 ALAssetsGroupSavedPhotos

To get photos from camera roll use ALAssetsGroupSavedPhotos while enumerating assets library:

[library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos
                       usingBlock:enumerate
                     failureBlock:nil];

要检测您当前获得的群组:

To detect what group you currently get:

if ([[group valueForProperty:@"ALAssetsGroupPropertyType"] intValue] == ALAssetsGroupSavedPhotos)
{
    NSLog(@"Camera roll");
}

这篇关于ALAssetsLibrary获取相机胶卷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 02:24