iOS相册里新建一个文件夹

NSMutableArray *groups=[[NSMutableArray alloc]init];
ALAssetsLibraryGroupsEnumerationResultsBlock listGroupBlock = ^(ALAssetsGroup *group, BOOL *stop)
{
    if (group)
    {
        [groups addObject:group];
    }
    else
    {
        BOOL haveHDRGroup = NO;
        for (ALAssetsGroup *gp in groups)
        {
            NSString *name =[gp valueForProperty:ALAssetsGroupPropertyName];
            if ([name isEqualToString:@"你的相册名字"])
            {
                haveHDRGroup = YES;
            }
        }
        if (!haveHDRGroup)
        {
            //do add a group named "XXXX"
            [assetsLibrary addAssetsGroupAlbumWithName:@"你的相册名字"
                                           resultBlock:^(ALAssetsGroup *group)
             {
                 [groups addObject:group];
             }
                                          failureBlock:nil];
            haveHDRGroup = YES;
        }
    }
};
//创建相簿
[assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAlbum usingBlock:listGroupBlock failureBlock:nil];```

你可能感兴趣的:(iOS相册里新建一个文件夹)