How to get gallery images in iOS?

杀马特。学长 韩版系。学妹 提交于 2019-12-01 11:19:51
Vincent Bernier

On that post there is a refence there.
It is looking interesting.

If not what you seek, you can create your own UIImagePicker, and you will need to go through the Assets Library framework to get access to the photos of the iPhone

The Assets Library framework provides access to the photos and videos in the user’s photo library.

See ALAssetsLibrary class.

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

Code might be something like this

void (^assetEnumerator)(struct ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) {
    if(result != NULL) {
        NSLog(@"See Asset: %@", result);
    }
    };

    void (^assetGroupEnumerator)(struct ALAssetsGroup *, BOOL *) =  ^(ALAssetsGroup *group, BOOL *stop) {
    if(group != nil) {
            [group enumerateAssetsUsingBlock:assetEnumerator];
    }
    };

    library = [[ALAssetsLibrary alloc] init];
    [library enumerateGroupsWithTypes:ALAssetsGroupAlbum
                       usingBlock:assetGroupEnumerator
                     failureBlock: ^(NSError *error) {
                         NSLog(@"Failure");
                     }];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!