APPhotolibrary 0.0.2

APPhotolibrary 0.0.2

测试已测试
语言语言 Objective-CObjective C
许可证 MIT
版本最后发布2014年12月

Alexey Belkevich 维护。



  • 作者
  • Alexey Belkevich

APPhotolibrary 是对 ALAssetsLibrary 的封装,并为 ALAsset 提供了一个分类

功能

  • 异步加载相册资源
  • 异步排序资源
  • 异步加载全分辨率照片
  • 异步加载全屏照片

安装

APPhotolibrary pod 添加到 Podfile

使用

加载照片
APPhotolibrary *photolibrary = [[APPhotolibrary alloc] init];
[photolibrary loadPhotosAsynchronously:^(NSArray *assets, NSError *error)
{
    if (!error)
    {
        // show assets
    }
    else
    {
        // show error
    }
}];
排序照片
photolibrary.sortAscending = YES;
photolibrary.sortComparator = ^NSComparisonResult(ALAsset *asset1, ALAsset *asset2)
{
    // return result of comparsion two assets   
};

默认排序为日期

从资源获取照片
#import "ALAsset+Photo.h"
...
ALAsset *asset = // assign asset
// photo thumbnail
self.thumbnailImageView.image = asset.photoThumbnail;
// load fullscreen photo (size depends on device screen)
__weak __typeof(self) weakSelf = self;
[asset loadPhotoInFullScreenAsynchronously:^(UIImage *image)
{
    weakSelf.fullScreenImageView.image = image;
}];
// load full resolution photo
[asset loadPhotoInFullResolutionAsynchronously:^(UIImage *image)
{
    weakSelf.fullScreenImageView.image = image;
}];

githalytics.com alpha

查看所有 Alterplay 的 GitHub 项目。 联系我们提供其他想法和项目。